【发布时间】:2015-09-12 20:43:34
【问题描述】:
我正在尝试为我的项目使用工具栏。 这是我正在使用的代码:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:background="?attr/colorPrimary"
android:contentInsetLeft="0dp"
android:elevation="@dimen/margin_padding_8dp"
android:contentInsetStart="0dp">
<RelativeLayout
android:id="@+id/rlToolbar"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingRight="@dimen/margin_padding_16dp"
android:text="AppBar"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textColor="@color/white"
android:textSize="@dimen/text_size_20sp" />
</RelativeLayout>
我想删除左边距,在这里我设置了 android:contentInsetLeft="0dp" 和 android:contentInsetStart="0dp" 但它 not 工作..请帮帮我!
【问题讨论】:
-
更改为使用 app:contentInsetLeft="0dp" 和 app:contentInsetStart="0dp"。将 xmlns:app="schemas.android.com/apk/res-auto" 添加到大多数父视图 xml
-
@calvinfly 感谢您的回答.. 就像一个魅力..
-
这不是左边距,它的工具栏内侧空间所以我们称之为工具栏左内边距,您可以删除左内边距。 Remove Space
-
possible duplicates@natuan241
-
这个链接对我很有用,试试吧...enter link description here
标签: android android-layout toolbar android-design-library