[英]Remove large padding after hamburger (menu) icon in Android Toolbar?
這是在我的項目沒有工作一個月(暑期學校)后發生的。 我剛剛回到它並注意到我更新Android Studio后工具欄上的這個差距比正常差距大。 我在SO上找不到任何關於此的問題/解決方案。 如果有人能提供幫助,那將非常感激。
我通過這樣做加載漢堡包圖標(每行都正確放置在應用程序中,在類聲明,onCreate()等中。為了簡單起見,我把它放在這里。):
ActionBarDrawerToggle mDrawerToggle;
mDrawerToggle = new ActionBarDrawerToggle(getActivity(), dl, toolbar, R.string.nav_open, R.string.nav_closed)
mDrawerToggle.syncState();
這是我的工具欄的xml代碼:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
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:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:title="Test Title">
</android.support.v7.widget.Toolbar>
我嘗試了各種contentInset
xml屬性但沒有影響菜單圖標后的間距。
編輯:此鏈接顯示我曾經擁有的(在頁面中間找到)。 如果您注意到標題和漢堡圖標之間的間距,則間距不會像此處所示的圖片那樣寬。 這就好像間距增加了一倍。
將這些屬性添加到Toolbar
:
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp"
這將禁用Toolbar
標題的插入開始填充
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.