drawable

Android drawable appears stretched for API <23 and correctly for API 23 and above

不羁的心 提交于 2021-02-08 05:09:51
问题 I am currently using a list selector for my listview and created it using layer-list. This is my 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 i build the app,

Android drawable appears stretched for API <23 and correctly for API 23 and above

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:08:01
问题 I am currently using a list selector for my listview and created it using layer-list. This is my 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 i build the app,

Android drawable appears stretched for API <23 and correctly for API 23 and above

萝らか妹 提交于 2021-02-08 05:05:04
问题 I am currently using a list selector for my listview and created it using layer-list. This is my 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 i build the app,

Different background for a button's states in Kotlin

蓝咒 提交于 2021-01-27 19:40:54
问题 I have a button in my project that works like this: The button has 3 different designs for each state - disabled ( state_enabled="false" ), enabled, pressed. This button remains disabled if no file is selected, and has a particular design for it. Although, when file is selected, this button becomes enabled and switches to a different design. And the button's highlight color is possible to see every time when the button is enabled and pressed. What I have tried so far: <?xml version="1.0"

Different background for a button's states in Kotlin

浪子不回头ぞ 提交于 2021-01-27 19:19:00
问题 I have a button in my project that works like this: The button has 3 different designs for each state - disabled ( state_enabled="false" ), enabled, pressed. This button remains disabled if no file is selected, and has a particular design for it. Although, when file is selected, this button becomes enabled and switches to a different design. And the button's highlight color is possible to see every time when the button is enabled and pressed. What I have tried so far: <?xml version="1.0"

How to make round corners for a ring shape in Android drawable

三世轮回 提交于 2021-01-27 02:26:08
问题 I have a custom progress bar that looks like this: Here's the .xml code I've used to create it: background_drawable.xml <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:innerRadius="@dimen/progress_bar_radial_inner_radius" android:thickness="@dimen/progress_bar_radial_thickness" android:shape="ring" android:useLevel="false" > <solid android:color="@color/main_color_alpha"/> </shape> progress_drawable.xml <?xml version="1.0"

Create rectangle border progress bar in android

不打扰是莪最后的温柔 提交于 2021-01-01 04:24:42
问题 I want to create a progress bar which should look like the above image. Someone has an idea to do this, is like a button but the borders are like a progress bar. Thanks 回答1: I solved with help of this How to create Diamond Progress Bar Android drawable/progress_drawable.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- background --> <item android:id="@android:id/background"> <shape> <corners android:radius="3dp"/> <solid

Create rectangle border progress bar in android

时光毁灭记忆、已成空白 提交于 2021-01-01 04:24:39
问题 I want to create a progress bar which should look like the above image. Someone has an idea to do this, is like a button but the borders are like a progress bar. Thanks 回答1: I solved with help of this How to create Diamond Progress Bar Android drawable/progress_drawable.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- background --> <item android:id="@android:id/background"> <shape> <corners android:radius="3dp"/> <solid

How to get image name from Drawable Object?

我们两清 提交于 2020-12-16 06:59:28
问题 Somehow I have Drawable image from Drawable folder like as Drawable thumb = mContext.getResources().getDrawable(R.drawable.image_name); i try like this String image_name =thumb.getCurrent().toString(); But my need image name that means image_name from thumb; How it is possible? Any suggestion, comment, consults; provide useful links are highly appreciate. Advance Thanks 回答1: You can try like this: int imageid = getResources().getIdentifier("image_name", "drawable", getPackageName()); String

How to get image name from Drawable Object?

时光怂恿深爱的人放手 提交于 2020-12-16 06:57:44
问题 Somehow I have Drawable image from Drawable folder like as Drawable thumb = mContext.getResources().getDrawable(R.drawable.image_name); i try like this String image_name =thumb.getCurrent().toString(); But my need image name that means image_name from thumb; How it is possible? Any suggestion, comment, consults; provide useful links are highly appreciate. Advance Thanks 回答1: You can try like this: int imageid = getResources().getIdentifier("image_name", "drawable", getPackageName()); String