¿Cómo eliminar la línea inferior/el trazo de la vista?
Frecuentes
Visto 1,957 veces
0
How to remove bottom line/stroke from view ? I am using to set background xml file like
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@color/inactive_tab" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
<stroke
android:width="2dp"
android:color="@android:color/black" />
<padding
android:left="7dp"
android:top="7dp"
android:right="7dp"
android:bottom="0dp" />
</shape>
but it has bottom line.
1 Respuestas
3
Use layer-list to layer other rectangle on top of the bottom rectangle. Try the following code:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<stroke
android:width="1dp"
android:color="#FF000000" />
<solid android:color="#000000" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
</shape>
</item>
<item
android:left="5dp"
android:right="5dp"
android:top="5dp"
android:bottom="-1dp">
<shape android:shape="rectangle" >
<stroke
android:width="0dp"
android:color="#FFDDDDDD" />
<solid android:color="#FFDDDDDD" />
</shape>
</item>
</layer-list>
Enlace relacionado: add_border
contestado el 23 de mayo de 17 a las 12:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android android-view android-custom-view or haz tu propia pregunta.
You could layer another rectangle shape on top of the bottom area of above drawable, but that isn't ideal in terms of overdraw. A more appropriate solution would be to render the drawable out to a 9 patch and remove the bottom border. - MH.