0

タイトルをアクションバーの中央に配置したい。ホームアイコンが表示されている場合は中央に表示されるカスタムレイアウトを作成しましたが、それが false に設定されている場合、タイトルは左に移動するため中央に表示されません。

アクションバーには、タイトルとメニュー オプションのみを表示し、ユーザーを前の画面に戻すホーム アイコンは表示しないでください。私はそれに左マージンを与えようとさえしましたが、それでもうまくいきません。

これに対する回避策はありますか??

<?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/txtTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:ellipsize="end"
    android:maxLines="1"
    android:text="@string/app_name"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="@android:color/white"
    android:textSize="@dimen/title_size" />

</RelativeLayout>
4

0 に答える 0