日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Android Toolbar Padding

發布時間:2025/5/22 65 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android Toolbar Padding 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

版權聲明:本文為博主原創文章,未經博主允許不得轉載。

在API version 21 (the support library),如何正常使用Toolbar

這是常規式布局出來的Toolbar,我設置了bg,明顯左邊和上面都有邊距:

?

然后,我更改后的代碼如下:

<android.support.v7.widget.Toolbarandroid:id="@+id/toolbar"android:layout_height="wrap_content"android:layout_width="match_parent"android:background="?attr/colorPrimary"android:padding="0dp"android:layout_margin="0dp"><RelativeLayoutandroid:id="@+id/action_bar_layout"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_margin="0dp"android:padding="0dp"android:background="#000000"><Spinnerandroid:layout_width="wrap_content"android:layout_height="wrap_content"/></RelativeLayout> </Toolbar>

你會發現設置padding為0這個屬性是沒有用的,直接看下面效果圖:

?

這顯示我設置的spinner為72dp了。?

Edit 1

我需要正常的顯示我的spinner,去掉padding,Here I going to find Google API:

?

Edit 2

下面我將contentInsetStart設置為0。您將需要使用的支持庫應用程序名稱空間:

<android.support.v4.widget.DrawerLayoutxmlns: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.support.v7.widget.Toolbarandroid:id="@+id/toolbar"android:layout_height="wrap_content"android:layout_width="match_parent"android:minHeight="@dimen/action_bar_height"android:background="?attr/colorPrimary"android:contentInsetStart="0dp"android:contentInsetLeft="0dp"app:contentInsetLeft="0dp"app:contentInsetStart="0dp"app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"app:popupTheme="@style/ThemeOverlay.AppCompat.Light"></android.support.v4.widget.DrawerLayout>

希望能幫到別人,這個困擾了我近一天的question!

版權聲明:本文為博主原創文章,未經博主允許不得轉載。

轉載于:https://www.cnblogs.com/Lt-Java13/p/5018392.html

總結

以上是生活随笔為你收集整理的Android Toolbar Padding的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。