android-drawable

Android does not honor ldpi qualifier

╄→尐↘猪︶ㄣ 提交于 2019-12-25 02:37:30
问题 I want to distinguish layout/drawables for the following two devices: 1) 7" hdpi 2) 7" ldpi So I am using the following qualified directories: 1) layout-sw600dp-hdpi / drawable-sw600dp-hdpi 2) layout-sw600dp-ldpi / drawable-sw600dp-ldpi But when I run on a 7" ldpi device with screen size in pixels 480x764, then Android (V4.0.3) chooses the hdpi version. Why is that? When I read the documentation, ldpi should be the better fit. When I remove layout-sw600dp-hdpi / drawable-sw600dp-hdpi

Replace Navigation View Item Ripple Effect

佐手、 提交于 2019-12-25 01:46:37
问题 I am attempting to replace what I thought was the default item background of the NavigationView . So I created a drawable to replace the background and applied it using the itemBackground attribute. background_navigation_view_item.xml <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/navigation_item_background_tint"> <item android:id="@android:id/mask" android:top="4dp" android:bottom="4dp" android:left="8dp" android:right="8dp"> <shape android:shape=

Android Make Spinner look like ImageView

匆匆过客 提交于 2019-12-25 01:32:13
问题 I've seen this post with a solution to make a Spinner look like an EditText. What I want instead is the spinner to look like an ImageView (the selected Image). This way the Spinner is completely stripped of unnecessary padding and the triangle at the bottom-right. (So on the screen it's an Image, but if you click on it, it opens up like a Spinner.) PS: I already have a custom Spinner with Images as items, but I still have some padding issues and the spinner-triangle that I would like to

How to create a circle drawable?

纵然是瞬间 提交于 2019-12-25 01:13:38
问题 How to a create a drawable of a circle, with blue stroke of 5 pixels and a transparent fill. I will be passing this drawable to an ItemizedOverlay . I want to do this with code and I will know the radius of the circle. 回答1: Try something along the lines of: <shape xmlns:android="http://schemas.android.com/apk/res/android" type="OvalShape" > <stroke android:width="5dp" android:color="#99104E8B"/> .... </shape> Just put something like this in an XML file in you drawables directory and load it

Invalid color in Android Compilation. How to fix .9.png

橙三吉。 提交于 2019-12-24 10:37:28
问题 I'm getting the following error when compiling in Android Studio Android resource compilation failed Output: error: found an invalid color. The image that is causing the error is already a .9.png file and it looks like this in Android Studio I am not sure how to solve this. I referred to this two questions How can I track down the cause of Android "found an invalid color" error Android : 9-Patch image Error and both indicate that the border around the image should be transparent. I'm guessing

Scaling then rotating a rectangle drawable

江枫思渺然 提交于 2019-12-24 09:51:03
问题 I would like to scale a rectangle drawable downwards, then rotate it so once it is clipped by the view it resembles a trapezoid with the left side slanted: The rotation is working fine: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item > <rotate android:fromDegrees="-19.5" android:toDegrees="-19.5" android:pivotX="0%" android:pivotY="0%" > <shape android:shape="rectangle" > <solid android:color="@android:color/black" /> <

Change background for radio button programatically

孤街浪徒 提交于 2019-12-24 09:44:13
问题 I have a RadioGroup with two RadioButtons. I want to change the color of them programmatically when they are disabled. <RadioGroup android:id="@+id/radio_group_transfer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="22dp" android:layout_marginTop="4dp" android:gravity="center_vertical" android:layoutDirection="ltr" android:orientation="horizontal"> <RadioButton android:id="@+id/national_id_docs" android:layout_width="match_parent"

Android Images are not displayed after release build or if i instant run turn off

懵懂的女人 提交于 2019-12-24 07:16:10
问题 I am getting images id from drawable-hdpi at run time using getIdentifier method using following code mContext.getResources().getIdentifier(mContext.getPackageName() + ":drawable/" + mCur.getString(mCur.getColumnIndex(Constant.COLUMN_IMAGE_DRAWABLE)), null, null) i also tried following ways mContext.getResources().getIdentifier(mCur.getString(mCur.getColumnIndex(Constant.COLUMN_IMAGE_DRAWABLE))+"", "drawable", mContext.getPackageName()); and set image resource using following code imgPosotion

TextView width match drawableTop width

可紊 提交于 2019-12-24 04:56:06
问题 Is there someway to make TextView width match compound Drawable width (XML)? For example for xml code: <TextView android:id="@+id/textView" style="@style/TextIcons" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/icon_contact" android:gravity="center" android:lines="2" android:text="@string/contact_label" /> I get: |---------------------| | |-------------| | | | | | | | Drawable | | | | View | | | | | | | |-------------| | |[---Contact

Possible to create subfolders in drawable folder in Android Studio? [duplicate]

感情迁移 提交于 2019-12-24 04:49:28
问题 This question already has answers here : Can the Android drawable directory contain subdirectories? (20 answers) Closed 5 years ago . Is it possible to create subfolder structures inside main res folders, especially in drawable folder using Gradle? I have attempted this so far sourceSets { main { res.srcDirs = [ "/src/main/res/drawable-xhdpi/actionbar_items", "/src/main/res/drawable-xhdpi/intro", "/src/main/res/drawable-xhdpi/loading_screen", "/src/main/res/drawable-xhdpi", "/src/main/res", ]