Android TextInputLayout不是';t显示
我是Android应用开发领域的新手。我正在尝试一些基本的东西。目前,我正在尝试实现一个浮动标签,就像在各种材质设计应用程序中看到的那样 我想做的是得到一个Android TextInputLayout不是';t显示,android,xml,material-design,Android,Xml,Material Design,我是Android应用开发领域的新手。我正在尝试一些基本的东西。目前,我正在尝试实现一个浮动标签,就像在各种材质设计应用程序中看到的那样 我想做的是得到一个CardView并在该卡中放置一个TextInputLayout <android.support.v7.widget.CardView android:layout_width="310dp" android:layout_height="250dp" android:layout_be
CardView
并在该卡中放置一个TextInputLayout
<android.support.v7.widget.CardView
android:layout_width="310dp"
android:layout_height="250dp"
android:layout_below="@+id/textView"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView"
android:layout_marginTop="13dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/labeltest"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="floating label"/>
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
如果您阅读,您会发现
colorAccent
用作字段下方行的颜色。您将colorAccent
设置为白色(请参见colors.xml
文件),因此,我猜测TextInputLayout
与父项的背景色混合,父项的背景色也是白色或类似颜色。尝试将colorAccent
更改为红色或其他颜色,看看是否是问题。android:layout\u height=“wrap\u content”
在编辑文本中。在您当前的代码中,父项有换行内容,子项有匹配父项,它们相互抵消为0,因此,请确保有适当的子级和父级布局参数,建议将TextInputLayout
与TextInputLayout
一起使用,而不是简单的EditText
@MohammedAtif刚刚尝试android.support.design.widget.textinputText
。当我使用它时,它变得完全不可见和不可链接。请添加colors.xml
文件?@IulianPopescu添加
<resources>
<color name="colorPrimary">#E43F3F</color>
<color name="colorPrimaryDark">#E12929</color>
<color name="primary_darker">#CC1D1D</color>
<color name="colorAccent">#FFFFFF</color>
<color name="black">#000000</color>
<color name="jet">#222222</color>
<color name="oil">#333333</color>
<color name="monsoon">#777777</color>
<color name="jumbo">#888888</color>
<color name="aluminum">#999999</color>
<color name="base">#AAAAAA</color>
<color name="iron">#CCCCCC</color>
<color name="white">#FFFFFF</color>
<color name="Trans_text">#a8ffffff</color>
</resources>