当前位置: 移动技术网 > IT编程>移动开发>Android > Android仿微信输入框效果的实现代码

Android仿微信输入框效果的实现代码

2019年07月24日  | 移动技术网IT编程  | 我要评论

新僵尸先生电影,刻录炼金师,陶阳近况

仿微信输入框效果图:

输入框:

<edittext
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginleft="50dp"
   android:layout_marginright="50dp"
   android:background="@drawable/weixin_edittext"
   android:layout_alignparentbottom="true"
   android:layout_marginbottom="6dp"
   android:paddingleft="5dp"
   android:paddingright="30dp"
   android:textcolor="#000000"/>1
background: 
<?xml version="1.0" encoding="utf-8"?>
<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> 

思路:

采用layerlist来实现,分三层实现,这里假设activity的背景是白色,第一层也(就是最底层)是绿色;第二次是白色,但是距离底部有一段小偏移,目的是为了做出文本框两边的小勾;第三层也是白色,但是它距离底部和左右两边都有一定距离。通过三层配合,即可实现这种效果。

以上所述是小编给大家介绍的android仿微信输入框效果的实现代码,希望对大家有所帮助

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网