回答
尝试这样的柔焦效果:
edt_bg_selector.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/edt_bg_selected" android:state_focused="true"/>
<item android:drawable="@drawable/edt_bg_normal" android:state_focused="false"/>
</selector>
edt_bg_normal.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1px"
android:color="#FF000000" />
<solid android:color="#00FFFFFF" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
</shape>
</item>
</layer-list>
edt_bg_selected.xm L:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1px"
android:color="#ff0000" />
<solid android:color="#00FFFFFF" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
</shape>
</item>
</layer-list>
,改变像你编辑短信:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/edt_bg_selector" />
还有一个问题,我必须改变这个属性才能使边框稍微粗一点? @Srikanth – Ron
我认为我们不能画出比1px更薄的绘图,因为它是基本单位。你可以像这样设置0.01dp。但是只有使用'px =(int)(scale * dp + 0.5)'这个公式,其中scale为'1 for mdpi','1.5 for hdpi','2 for xhdpi'和'3 for xxhdpi' ”。 – Srikanth
如果您想要比1px更薄,请尝试将可绘制颜色更改为更透明的颜色,如“#26000000”。检查透明度百分比'http://stackoverflow.com/questions/15852122/hex-transparency-in-colors'。 – Srikanth
尝试这样如下:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="Biografie"
android:textColorHint="#99000000"
android:drawableLeft="@drawable/quote_img" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#80000000" />
</LinearLayout>
或者
保持这种btm_line_shape.xml在你绘制的文件夹:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:bottom="1dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape android:shape="rectangle" >
<stroke
android:width="1px"
android:color="#FF000000" />
<solid android:color="#00FFFFFF" />
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
</shape>
</item>
</layer-list>
和
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Biografie"
android:textColorHint="#99000000"
android:background="@drawable/btm_line_shape"
android:drawableLeft="@drawable/quote_image" />
- 1. 固定大小的边框底部
- 2. 更改边框底部到边框顶部
- 3. 刷新时更改边框底部和边框顶部颜色
- 4. 盒子大小的边框不工作的顶部和底部边框
- 5. 更改边界框的大小
- 6. 更改Edittext onFouce的边框(Android)
- 7. 更改的EditText边框颜色
- 8. StackPanel底部边框
- 9. 与边框底部
- 10. 在Excel中左右,底部和顶部更改边框
- 11. Edittext更改边框颜色始终onclick
- 12. 顶部和底部边框
- 13. 使底部边框更接近文本
- 14. 如何更改UINavigationBar底部边框的颜色?
- 15. 如何更改p-dataTable边框底部的颜色?
- 16. 在matplotlib底图中更改边框
- 17. 如何更改底部边界半径?
- 18. 改变EditText焦点边框
- 19. 3个单边的边框底部?
- 20. 更改导航栏底部边框颜色斯威夫特
- 21. Android更改微调主题/底部边框样式
- 22. Xamarin Forms - 使用XAML更改光标颜色和底部边框
- 23. 如何更改左边/顶部/右边/底部
- 24. 如何改变TMUX的边框大小
- 25. 边框不改变文字的大小
- 26. CSS引导边框底部
- 27. CSS块底部边框
- 28. CSS底部边框问题
- 29. 底部渐变边框
- 30. CSS边框底部IEXPLORER
下划线或底部边框? coz下划线是字体的属性不是gui – anshuVersatile
@anshu我想我的意思是底部边框 – Ron