xml - Android drawable appears stretched for API <23 and correctly for API 23 and above -
i using list selector listview , created using layer-list. xml code:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/menu_arrow" android:width="18dp" android:height="36dp" android:top="5dp"/> <item android:top="0dp" android:left="5dp" android:bottom="0dp" android:right="0dp"> <shape android:shape="rectangle"> <solid android:color="@android:color/transparent"/> </shape> </item>
when build app, appears fine on api 23 , above.
but api 22 , below, looks this:
i came across post shape drawable in layer-list rendered incorrectly apis below 23 , understood attributes width , height work api 23 , above. added width , height inside size tag :
<item android:drawable="@drawable/menu_arrow" android:top="5dp"> <size android:height="36dp" android:width="18dp"/> </item>
but image still appears stretched. attribute needed api 22 , below make drawable uniform versions?
i managed solve in following way :
<item android:drawable ="@drawable/menu_arrow" android:right="285dp" android:top="5dp" android:bottom="10dp"/>
i guess api < 23 need resize drawable using top,right,bottom values , api > 23 can use width , height.
Comments
Post a Comment