How to use a shape drawable together with an image?

You could use LayerDrawable, which could contain as many layers(shapes or images) as you need. You can create it either as resource or programmatically. <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/rounded_corners” android:id=”@+id/rounded_corners”/> <item android:drawable=”@drawable/additional_image” android:id=”@+id/additional_image” /> </layer-list>

Android: How to Make A Drawable Selector

You can add this in Android Studio, use Right click on project structure -> New -> Drawable resource file. It should look like this: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_enabled=”false” android:drawable=”@drawable/cell_top_selected” /> <item android:drawable=”@drawable/cell_top” /> </selector>

how to get android gradient center light effect?

Make a new Android xml file (say GreyRadial.xml) file in your drawable folder In your xml file <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” > <gradient android:centerColor=”#c1c1c1″ android:endColor=”#4f4f4f” android:gradientRadius=”400″ android:startColor=”#c1c1c1″ android:type=”radial” > </gradient> </shape> Use this xml in your layout background using android:background=”@drawable/GreyRadial”

Android shape border with gradient

try something like this: <?xml version=”1.0″ encoding=”UTF-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape android:shape=”rectangle” > <gradient android:angle=”360″ android:centerColor=”#e95a22″ android:endColor=”#ff00b5″ android:gradientRadius=”360″ android:startColor=”#006386″ android:type=”sweep” /> <stroke android:width=”2dp” android:color=”#ff207d94″ /> </shape> </item> <item android:bottom=”2dp” android:left=”2dp” android:right=”2dp” android:top=”2dp”> <shape android:shape=”rectangle” > <solid android:color=”#fff” /> </shape> </item> </layer-list>

BitmapFactory.decodeResource() returns null for shape defined in xml drawable

Since you want to load a Drawable, not a Bitmap, use this: Drawable d = getResources().getDrawable(R.drawable.your_drawable, your_app_theme); To turn it into a Bitmap: public static Bitmap drawableToBitmap (Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable)drawable).getBitmap(); } Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); return … Read more

techhipbettruvabetnorabahisbahis forumu