drawable

Add shadow on right and bottom side of the layout

心已入冬 提交于 2019-12-03 05:36:30
I want to add a light shadow on the right and bottom side of the layout.I tried using android:background="@android:drawable/dialog_holo_light_frame" but it adds a thick shadow on all four sides of the layout.What drawable i need to create and set as background? <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@android:drawable/dialog_holo_light_frame"> <ImageView android:id="@+id/g" android:layout_width="wrap_content" android:layout_height="wrap

Android: drawable id change after resources modify

纵饮孤独 提交于 2019-12-03 05:27:33
I have an android application that use a gallery component to choose an icon and assign it to a button. The icon set is located in res/drawable folder and is accessed in the gallery with the typical adapter of the guide: private Integer[] Imgid = { R.drawable.icon_home, R.drawable.icon_home2, ... } After an icon choosing, i stored the settings in a db with id of the button and of the drawable. All works done, but i've noticed that if i'll want to add or modify my icon set or resources in general of my application, ids of old resource could change, so the preferences in the db refers to wrong

Is possible use drawable-mdpi-fr, drawable-hdpi-fr, drawable-ldpi-fr, for localization with different resolutions

北战南征 提交于 2019-12-03 05:27:31
I want to use different images for different localisations. However, I have images for all resolutions and for all languages. Is there any way to do this? yes, it is possible by. drawable-de-rDE-ldpi,drawable-de-rDE-mdpi . check it. Is possible use drawable-mdpi-fr, drawable-hdpi-fr, drawable-ldpi-fr, for localization with different resolutions Yes. Obviously, this gets tedious for too many translations, and if there are too many affected images your APK size may grow substantially. Since Android will automatically rescale images, you might try just res/drawable-fr-xhdpi/ and see what it looks

How to set drawable size in layer-list

那年仲夏 提交于 2019-12-03 05:22:07
I'm having problem with setting size of drawable in layer-list. My XML looks like this: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/menu_drawable1"/> <item android:drawable="@drawable/menu_drawable2"/> </layer-list> Drawable1 is bigger than Drawable2, so Drawable2 gets resized. How to override this and set the original size of Drawable2? I don't want it to resize. I tried with setting width and height but that doesn't work. Also the drawables aren't actually bitmaps, they are selectos, so I can't use the bitmap trick. It looks like

Android - How to show a vertical line on the background of a ListView (and according to row height)?

只愿长相守 提交于 2019-12-03 05:13:37
问题 How to show a vertical line on the background, such as the one highlighted in blue on the image below? In this example, I have a ListView with ImageView elements (and TextView, but it is not related to the line), and I want a vertical line on the background of these items to feel like they are "connected" to each one. And also, note that the vertical line does not fill all the background. The vertical line is on the left, and it is not equal for the all cases. Sometimes it fills all the row

Are there any Android Drawable designers?

萝らか妹 提交于 2019-12-03 04:06:34
问题 I would like to use more vector drawings in my Android applications. Providing images isn't as space efficient or as scalable as I would like it to be. Android provides a series of Drawable file formats, such as ShapeDrawable , which can be combined in a LayeredDrawable . To go very far down this path, it would be nice if there was a designer for visualizing the results, doing the drawing in, and handling all the resulting files. C# WPF has Expression Blend, Adobe has Flash CS4, and the

Creating a shortcut: how can I work with a drawable as Icon?

≯℡__Kan透↙ 提交于 2019-12-03 03:26:55
Below is My code to create a shortcut to a selected application. I have really no problem and the application work quite well. The problem is that I am able to create a shortcut with a ressource from my application: intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.icon)); But I really would like with a custom drawable. ( Drawable myDrawable=.....) How can I do? ResolveInfo launchable=adapter.getItem(position); final Intent shortcutIntent = new Intent(); ActivityInfo activity=launchable.activityInfo; ComponentName name=new

NinePatchDrawable does not get padding from chunk

喜欢而已 提交于 2019-12-03 03:07:17
I need help with NinePatchDrawable: My app can download themes from the network. Almost all things work fine, except 9-Patch PNGs. final Bitmap bubble = getFromTheme("bubble"); if (bubble == null) return null; final byte[] chunk = bubble.getNinePatchChunk(); if (!NinePatch.isNinePatchChunk(chunk)) return null; NinePatchDrawable d = new NinePatchDrawable(getResources(), bubble, chunk, new Rect(), null); v.setBackgroundDrawable(d); d = null; System.gc(); getFromTheme() loads the Bitmap from the SD card. The 9-Patch PNGs are already compiled, that means they include the required chunk. The way

Create a custom Drawable and use it in XML

≡放荡痞女 提交于 2019-12-03 01:31:12
I am busy creating a less complicated version of NinePatchDrawable that tiles the inner panels instead of stretching them. I can implement the actual logic to do the rendering and such. However, I can't find documentation about how to use this Drawable in the XML files. Is this possible? That is, can I have a <tileable-nine-patch> , or some such, tag I can use to define resources? Unfortunately it is not possible to use custom drawables in XML files (for API 23 and below) due to potential security issues. See here for a Google Groups thread about this very topic with a response from Romain Guy

Create a progress drawable programmatically

China☆狼群 提交于 2019-12-03 00:43:47
I have a scenario where i need to have a large number of progress bar drawables. I cant create xml resources for all of them because i want the user to choose a color that will then be used to dynamically create the drawable. Below is one such drawable in xml, how can i create this exact drawable programmatically? <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <solid android:color="@color/transparent" /> <stroke android:width="2px" android:color="@color/category_blue_stroke"/> </shape> </item> <item android:id="