Sunday, 15 May 2011

android - Shape background as image -



android - Shape background as image -

i trying set shape color image, failing so. maybe tell me how in proper way? utilize shape background buttons.

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="rectangle">        <corners android:bottomrightradius="7dp"        android:bottomleftradius="7dp"        android:topleftradius="7dp"        android:toprightradius="7dp"/>            <stroke        android:width="0.5dp"        android:color="#ff0000" />                <solid android:color= "@drawable/tableback1" /> </shape>

this not possible in way presented in question.

as per documentation here: http://developer.android.com/guide/topics/resources/drawable-resource.html#shape solid.color attribute value must color , not drawable. color used fill whole shape. you're passing drawable seen here:

<solid android:color= "@drawable/tableback1" />

instead should along lines:

<solid android:color="@color/background_color1" />

or simply:

<solid android:color="#ffff0000" />

android xml

No comments:

Post a Comment