怎么在Android应用中添加一个文本输入框

怎么在Android应用中添加一个文本输入框?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

xml如下:

<&#63;xml version="1.0" encoding="utf-8"&#63;>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
  <item>
    <shape android:shape="rectangle" >
      <solid android:color="#0ac39e" />
    </shape>
  </item>
  <item android:bottom="6dp">
    <shape android:shape="rectangle" >
      <solid android:color="#ffffff" />
    </shape>
  </item>
  <item
    android:bottom="1dp"
    android:left="1dp"
    android:right="1dp">
    <shape android:shape="rectangle" >
      <solid android:color="#ffffff" />
    </shape>
  </item>

</layer-list>然后,将xml设置为文本框的背景即可。需要注意的是,这种方式没法一个xml drawable同时用在各种不同颜色的背景下。

看完上述内容,你们掌握怎么在Android应用中添加一个文本输入框的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!