【发布时间】:2014-01-23 08:59:37
【问题描述】:
我使用删除了图标 getActionBar().setDisplayShowHomeEnabled(false);
我正在使用一个应该填满整个操作栏的图像视图。我想这样做是因为我希望图像作为标题栏,包括徽标和文本视图。但是还是希望能够使用actionbar的功能。所以发生的事情是它在图标曾经所在的位置有一个起始间隙。使用 match_parent 或 fill_parent。
标题栏.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:background="@android:color/white">
<ImageView
android:id="@+id/header"
android:contentDescription="@string/app_name"
android:background="@drawable/ic_launcher"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginStart = "20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginTop = "5dp"
android:text="@string/titlebarText"
android:gravity ="right"
android:textColor="@android:color/black"
android:textStyle="bold"
/>
</LinearLayout>
http://i.imgur.com/3eTldKh.png
这就是我想做的动作栏
【问题讨论】: