If you are using NavigationView
NavigationView provides a convenient way to build a navigation drawer, including the ability to creating menu items using a menu XML file. We've expanded the functionality possible with the ability to set custom views for items via app:actionLayout or using MenuItemCompat.setActionView().
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header"
app:menu="@menu/drawer_menu" />
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:checkableBehavior="single">
<item android:id="@+id/nav_item1"
app:showAsAction="always"
android:title=""
app:actionLayout="@layout/menu_item_layout" />
</group>
</menu>
you can customize as you want
<?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">
<TextView android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:text="Item text" />
</RelativeLayout>
you can create FrameLayout
in which add your Titile TextView
and above that your Count TextView
as follows t
<FrameLayout>
<TextView></TextView> //your titile TextView
<TextView></TextView> //your count TextView which has gravity of top right and circular background drawable
</FrameLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.