Comments (1)
Yes, you can do it via using a Custom Drawer ListItem Layout.
You can find the example below.
Bear in mind that your custom layout's Root Layout should be RelativeLayout
, and the id of TextView (for the title) shoud be list_item_title
, and id of the ImageView (for the icon) should be list_item_img
.
Here is an example of the Custom Drawer ListItem Layout. (Let's name it tab_list_item.xml
)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp" ---> You can add margin <---
android:padding="5dp" ---> or padding <---
android:gravity="center_vertical|start"
android:orientation="horizontal">
<ImageView
android:id="@+id/list_item_img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/item_logo" />
<TextView
android:id="@+id/list_item_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|start"
android:padding="3dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
</LinearLayout>
</RelativeLayout>
In your activity, when you are defining TabDrawerData, you simply add
.setCustomDrawerListItemLayoutResourceId(R.layout.tab_list_item)
And you are done.
from tabdrawer.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tabdrawer.