Android仿微信輸入框效果的實(shí)現(xiàn)代碼
仿微信輸入框效果圖:
輸入框:
<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來實(shí)現(xiàn),分三層實(shí)現(xiàn),這里假設(shè)activity的背景是白色,第一層也(就是最底層)是綠色;第二次是白色,但是距離底部有一段小偏移,目的是為了做出文本框兩邊的小勾;第三層也是白色,但是它距離底部和左右兩邊都有一定距離。通過三層配合,即可實(shí)現(xiàn)這種效果。
以上所述是小編給大家介紹的Android仿微信輸入框效果的實(shí)現(xiàn)代碼,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時(shí)回復(fù)大家的!
相關(guān)文章
Android通過wifi連接手機(jī)(不需要root)
這篇文章主要為大家詳細(xì)介紹了Android通過wifi連接手機(jī),不需要root,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-06-06Android?Studio實(shí)現(xiàn)簡易計(jì)算器源碼
這篇文章主要為大家詳細(xì)介紹了Android?Studio實(shí)現(xiàn)簡易計(jì)算器源碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-05-05Android NDK開發(fā)之:配置環(huán)境的詳解
本篇文章是對Android中的配置環(huán)境進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05Android 同時(shí)setTag兩次保存多種值的示例代碼
這篇文章主要介紹了Android 同時(shí)setTag兩次保存多種值的示例代碼,需要的朋友可以參考下2017-02-02