android 控件描边取消重叠
生活随笔
收集整理的這篇文章主要介紹了
android 控件描边取消重叠
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天寫組件的時候用到了描邊??墒莾蓚€組件放在一起時,描邊會變重疊,使之變粗。就不是很美觀了。
如何取消呢?網上查了好久沒找到,然后就自己試了試,找到了解決方法,就在此記錄一下,防止以后忘記。
很簡單分別給兩個控件添加?android:layout_marginRight="-1dp"和android:layout_marginLeft="-1dp"
這里面的值要設置成-1。否則是沒有效果的。設置后的效果:
布局文件如下。
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="horizontal" > 6 <EditText 7 android:id="@+id/myet" 8 android:layout_weight="4" 9 android:layout_width="0dip" 10 android:layout_height="50dp" 11 android:ems="10" 12 android:background="@drawable/border_text_selector" 13 android:layout_marginRight="-1dp" 14 android:singleLine="true" 15 > 16 </EditText> 17 <ImageView 18 android:id="@+id/myiv" 19 android:layout_weight="1" 20 android:layout_width="0dp" 21 android:layout_height="50dp" 22 android:background="@drawable/bg_border" 23 android:layout_marginLeft="-1dp" 24 android:src="@drawable/ic_launcher" /> 25 </LinearLayout>?
轉載于:https://www.cnblogs.com/Jett/p/3774764.html
總結
以上是生活随笔為你收集整理的android 控件描边取消重叠的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux vim使用心得--一些高级话
- 下一篇: Jacob Java程序把Word文档直