This is my application toolbar工具欄中不需要的左邊距/填充徽標
我以下面的方式添加了菜單按鈕和徽標。
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
getSupportActionBar().setLogo(R.drawable.ic_parking);
我試過在工具欄xml中使用doling,但它沒有幫助。
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
我想要做的是讓我的標誌接近菜單按鈕並應用一些填充。
更新 這裏是我的xml文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="@+id/root_login_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_collapseMode="pin"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
android:contentInsetRight="0dp"
android:contentInsetEnd="0dp"
app:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
/>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/layout_margin"
android:paddingLeft="@dimen/layout_margin"
android:paddingRight="@dimen/layout_margin"
android:paddingTop="@dimen/layout_margin"
android:layout_below="@+id/toolbar"
android:background="@drawable/background"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
你可以發表你的XML –
嘗試設置標題爲空字符串getSupportActionBar()的setTitle(「); –
冠軍在出現在標誌的右邊,所以我不力認爲這是問題 – Tushar