我试图SlidingTabLayout在我的内部放置android.support.v7.widget.Toolbar但由于某种原因在纵向布局中有额外的顶部和底部填充.如截图所示:
在横向布局中,android.support.v7.widget.Toolbar它更短,额外的填充消失了:
我知道contentInsertStart和contentInsetEnd属性,但似乎没有任何顶部和底部.这是我的布局:
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="?attr/actionBarTheme"
>
<!-- Changing the size of the toolbar fixed the problem below but I don't like the solution since the height difference is perceptible -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorPrimary"
android:padding="0dp"
app:popupTheme="?attr/actionBarPopupTheme"
>
<!-- TODO: BUG - This isn't filling out the action bar in portrait (see note above) -->
<com.myapplication.views.widgets.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/pink_400"
/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
如评论中所示,如果我手动将高度设置android.support.v7.widget.Toolbar为48dp然后将其 …
android android-support-library android-toolbar android-appbarlayout