android - 标签没有显示出来
问题描述
这是我的界面在 Android Studio 中的样子:
这是我在真实设备中的界面:
为什么标签没有显示出来,我什至不能改变EditText
背景颜色?
这是我的一些代码 XML 文件,我正在使用的以下部分和我正在使用ScrollView
的颜色部分相对布局。这两种布局都在一个CardView
.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/card_view"
<ScrollView
android:layout_width="match_parent"
android:layout_marginTop="235dp"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:background="@color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/transparent">
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:labelText="Email"
app:hasClearButton="true">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:inputType="textEmailAddress"
android:id="@+id/input_email"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical"
android:background="@color/transparent">
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:labelText="Username"
app:hasClearButton="true">
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/input_name"
android:inputType="textPersonName"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"/>
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
</LinearLayout>
解决方案
注意以下几行:
xmlns:app="http://schemas.android.com/tools"
...
app:labelText="Username" //app is a tool namespace, so label text only shown in preview
修改为:
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
...
app:labelText="Username"
推荐阅读
- sql - SQL subselect 语句在某些机器上非常慢
- mysql - 如何镜像自动增量值并与mysql中另一列中的值组合
- node.js - 服务器到服务器/路由到 Express 中的 Axios 请求
- python - 在电子生成器中包含文件?
- javascript - 将二进制/十六进制转换为 Base91 / Ascii85 / Base64
- firebase - Firestore array.push 不保存数据
- python - 如何告诉 pyreverse 在包中的模块中包含类?
- excel - 以不同颜色突出显示副本(并连接整行)EXCEL
- remix - 将共享文件夹连接到 Remix 时出现 Remixd 错误
- python - 无法比较 none 类型和 int 类型