我有一个布局与2-3个孩子。使用android将线性布局背景设置为以下可绘制:background属性。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#373949"/>
<stroke android:width="3dip" android:color="#FFF"/>
<corners android:radius="30dip" />
<padding android:left="10dip" android:top="10dip" android:right="10dip" android:bottom="10dip" />
</shape>但是当半径设置为30dip时,显示圆角,但返回到布局时显示矩形的默认灰色边框。有什么方法可以摆脱它吗?
提前感谢
发布于 2012-08-08 18:15:16
试试这段代码
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFFFF"/>
<corners android:radius="15px"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>发布于 2012-08-08 18:13:16
一旦你改变了视图的背景,这个可绘制的将不再是绘制UI的活动,因此视图的默认布局将是可应用的,所以如果你想要灰色布局也是四舍五入的,创建另一个可绘制,并设置那个可绘制而不是灰色。
发布于 2012-08-08 18:18:27
您看到的圆角边框是您更改过的布局的父项,background.If您的自定义背景属于您的活动,而不是您看到的灰色属于系统。您可以使用Hierarchy Viewer。要详细了解它。您也可以参考this 作为参考。
https://stackoverflow.com/questions/11862230
复制相似问题