3 回答

TA貢獻1812條經驗 獲得超5個贊
您獲得了正確的 XML,現在在 Toolbar 標記中執行類似的操作。1. 在工具欄中添加圖像作為背景或 2. 在工具欄中添加 ImageView 標簽
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="@drawable/toolbartitle" //either add a background here like this if it helps
local:theme="@style/MyMaterialTheme.Base"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
或者
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/color_blue"
app:popupTheme="@style/AppTheme.PopupOverlay">
<ImageView
android:id="@+id/tv_header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/header_title" />
</android.support.v7.widget.Toolbar>

TA貢獻1856條經驗 獲得超11個贊
設計你自己的 ActionBar,或者簡單地添加適當的
app:showAsAction="always"
在右側菜單的 menu.xml 文件中.....

TA貢獻1851條經驗 獲得超4個贊
菜單文件夾中以您的抽屜活動命名的菜單文件如下代碼所示,您可以根據需要更改它
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
添加回答
舉報