Tôi muốn đặt biểu tượng ở cuối thanh công cụ của tôi, bắt đầu hoạt động khác. thanh công cụ phần Myđặt biểu tượng ở cuối thanh công cụ
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/abc_action_bar_default_height_material"
android:background="#2B4AE0"
app:theme="@style/ToolBarStyle">
<TextView
android:id="@+id/headerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Theme"
android:textColor="@android:color/white" />
<RelativeLayout
android:id="@+id/notification"
android:layout_width="50dp"
android:layout_height="match_parent"
android:clickable="true"
android:gravity="center" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/bell_icon" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
tôi đã cố gắng
android:layout_alignParentEnd="true"
và lề trái thiết nhưng nó không hoạt động một cách chính xác.
Làm việc ......... –
@Sam trình. Nhưng khi bạn có các mục trong tệp 'menu_main', thì' ImageView' này sẽ được đặt ở bên trái các mục đó. Làm thế nào bạn sẽ đặt 'ImageView' luôn luôn sang bên phải (không có vấn đề nếu có các mục trình đơn hay không)? – CopsOnRoad