我的问题是,使用appcompat我只能创建一个工具栏,它是浮动的。在我的场景中,这看起来很难看。找不到任何教程/解决方案,可以创建不可浮动的工具栏。你有什么想法吗?
我目前的执行情况:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>更新:
浮动,我的意思是,它没有对齐上和右的左边框。相反,它只是无缘无故地飞行而已。
带Appcompat的浮动工具栏这是一个带有浮动工具栏的示例。
图片中的https://developer.android.com/training/appbar/index.html在这里是非浮动工具栏.
发布于 2016-11-11 14:24:11
如果没有完整的布局XML,很难给出一个好的答案,但根据您对问题的描述,听起来就像是根布局(或者任何包含Toolbar的视图都有填充设置的布局)。
从工具栏的父级移除所有填充,您应该得到您想要的内容。
发布于 2016-11-11 14:39:17
用这个怎么样:
<Toolbar
android:id="@+id/toolbar_bottom"
android:minHeight="?android:attr/actionBarSize"
android:background="?android:attr/colorAccent"
android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
android:popupTheme="@android:style/ThemeOverlay.Material.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />或者它需要类型为android.support.v7.widget.Toolbar?
您可以在这里找到本教程:非浮动工具栏
https://stackoverflow.com/questions/40516688
复制相似问题