我正在使用Toolbar
作爲底部工作表中的小部件。但標題沒有顯示。Android工具欄(作爲小部件)未顯示標題
我Toolbar
在bottomsheet佈局的內容是這樣的:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:title="This is my title"
app:theme="@style/ThemeOverlay.AppCompat.Light"
app:popupTheme="@style/AppTheme.PopupOverlay">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="?attr/selectableItemBackgroundBorderless"
android:onClick="@{() -> handler.hideBottomSheet()}"
android:src="@drawable/ic_keyboard_arrow_down_black_24dp" />
</android.support.v7.widget.Toolbar>
//...
</LinearLayout>
一切看起來都不錯。但標題並不只是顯示出來。這不是支持ActionBar
。我使用這個作爲一個部件。
我不知道爲什麼,但它只是不顯示。我嘗試了不同的主題,並且改變了根目錄LinearLayout
的背景顏色,但沒有運氣。
它只是不顯示。我也試過設置android:titleTextColor
,但那也沒有奏效。
僅當使用ActionBar
時纔可以使用標題?或者我在這裏做錯了什麼?謝謝。
pz發佈你的java代碼 –
Java代碼的哪個部分? – kirtan403
用工具欄替換動作條... –