【发布时间】:2017-04-26 06:12:26
【问题描述】:
如何摆脱 android 视图顶部的白框?我在我的代码中看不到任何地方我调用了创建工具栏的东西,我也没有自己编码。它也存在于视图之上,而不是其中。我猜xml文件的设计视图中有一些设置可以切换它?提前致谢!
** 我还应该包括它只在这个活动上,而我的其他活动顶部没有这个白条。此外,actionbar 是白色汽车上方的蓝色细条,因此任何涉及操作 actionbar 的代码都不会改变白色条的状态。 **
编辑:XML 代码如下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bucket"
android:theme="@+id/BucketTheme2"
android:backgroundTint="#70FFFFFF"
android:backgroundTintMode="src_over">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingBottom="5dp"
android:paddingTop="100dp"
android:text="Find a place to go around you!"
android:textColor="#ff000000"
android:textSize="18dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:onClick="randomButtonPressed"
android:text="RANDOMIZE"
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/bucketBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:onClick="bucketButtonPressed"
android:text="Bucket List"
android:textSize="20dp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/searchLocationBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:onClick="searchButtonPressed"
android:text="Search by Location"
android:textSize="20dp" />
</TableRow>
</TableLayout>
</RelativeLayout>
编辑 2:BucketTheme2 的 style.xml 代码如下(我最初没有发布它,因为它只设置颜色):
<style name="BucketTheme2" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
【问题讨论】:
-
分享你的布局代码
-
发布您的 xml 代码
-
删除
android:backgroundTint="#70FFFFFF" android:backgroundTintMode="src_over" -
也分享你的styles.xml。
-
你能上传style.xml吗?你用什么风格作为主题?我猜那是工具栏/应用栏/原色。
标签: android xml layout toolbar