マテリアル デザインをテストしており、拡張ツールバーを使用してアプリを開発しています。私のアプリは非常にシンプルです: メイン アクティビティが拡張ActionBarActivity
され、私のレイアウトは次のようになります。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".WeatherActivity"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/my_toolbar"
android:layout_height="128dp"
popupTheme="@style/ActionBarPopupThemeOverlay"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:text="@string/location_placeholder"
android:textAlignment="viewStart"
android:layout_gravity="start"
/>
</LinearLayout>
現在の場所をタイトルとして表示したいと思います。私が最初に気付いたのは、Android Emulator (API 18) で、タイトルが左マージンの下マージンに関する重要なガイドラインを尊重していないようで、左側に表示され、ツールバー内に垂直に入力されたことです。では、ツールバーのタイトル (toolbar.setTitle) などを使用する必要がありますか? 次に、タイトルや簡単な説明 (レイアウト構造のマテリアル ガイドラインに示されているように) などのより複雑なものを作成したい場合、レイアウトはどうすればよいですか? ご支援ありがとうございます!