android - how to set image in proper position in layers in layer-list? -
i trying set image in center of circle (trying on android 4.1.2)
but when run app shows image this
but when writing code in xml shows right image
here xml code
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:right="-1dp" android:left="-1dp" android:bottom="-1dp"> <shape> <solid android:color="#50000000" /> <corners android:radius="50dp" /> </shape> </item> <item android:height="20dp" android:width="20dp"> <shape> <corners android:radius="50dp" /> <stroke android:color="@color/white" android:width="1dp"/> <solid android:color="#50000000"/> </shape> </item> <item android:width="8dp" android:height="8dp" android:gravity="center" android:drawable="@drawable/news"> </item> </layer-list>
you can try this,
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> <solid android:color="#50000000"/> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="1dp" android:color="@color/coloraccent"/> <solid android:color="#50000000"/> </shape> </item> <item android:bottom="5dp" android:drawable="@drawable/news" android:gravity="center" android:left="5dp" android:right="5dp" android:top="5dp"> </item> </layer-list>
Comments
Post a Comment