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

仿微信输入框效果图:

输入框:

<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仿微信输入框效果的实现代码,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

相关文章

AdvserView.java package com.earen.viewflipper; import an...
ImageView的scaleType的属性有好几种,分别是matrix(默认)...
文章浏览阅读8.8k次,点赞9次,收藏20次。本文操作环境:win1...
文章浏览阅读1.2w次,点赞15次,收藏69次。实现目的:由main...
文章浏览阅读3.8w次。前言:最近在找Android上的全局代理软件...
文章浏览阅读2.5w次,点赞17次,收藏6次。创建项目后,运行项...