【发布时间】:2015-04-02 12:32:26
【问题描述】:
我有一排有两个 EditTexts 和两个 ImageButtons。在 android studio 的预览中,一切看起来都很好,并且 EditTexts 具有默认样式。但如果我在平板电脑上显示它,背景是黑色的。
应该是什么样子:
它在平板电脑上的样子:
其他 EditText-Boxes 正确显示。 有谁知道为什么这些看起来不同以及我该如何解决?
这里是这一行的 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
>
<EditText
android:id="@+id/first_input"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<EditText
android:id="@+id/second_input"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.4"
/>
<ImageButton
android:id="@+id/first_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:src="@drawable/move"
android:background="@drawable/first_button_background"
android:onClick="onFirstButtonClicked"
/>
<ImageButton
android:id="@+id/second_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:src="@drawable/trash"
android:background="@drawable/second_button_background"
android:onClick="onSecondButtonClicked"
/>
</LinearLayout>
编辑: 我尝试将背景颜色更改为白色,但 EditTexts 失去了整个样式,因此也不再显示下划线。
【问题讨论】:
标签: android android-layout android-edittext background-color android-styles