drawable

Custom Home Icon in Action Bar Sherlock

半城伤御伤魂 提交于 2019-12-02 23:33:34
I am trying to set custom icon for home icon using ActionBarSherlock library . I have tried to set custom layout using abHomeLayout attribute in my custom theme. But it didn't work for me. Only way, how to set it, is to set abIcon attribute for my custom drawble, but I cannot set some horizontal padding for this drawable. Is there any example for this or where could be a problem with abHomeLayout attribute? This works for my situation, it replaces the default ic_launcher icon in the action bar with my custom one. In your onCreate do this: getSupportActionBar().setIcon(R.drawable.audio_shortcut

Center CheckBox drawable within itself

你。 提交于 2019-12-02 20:12:54
I have a CheckBox that I want centered within its own boundaries, not pushed to the side. Probably easier demonstrated than explained: Note that it isn't centered. Currently defined as: <CheckBox android:id="@+id/checkbox_star" android:layout_width="wrap_content" android:layout_height="match_parent" android:button="@drawable/btn_favorite" android:layout_gravity="center" android:minWidth="48dp" /> Nevermind the custom button drawable. It behaves the same with a vanilla CheckBox as well (the small check box behaves the same). I believe the problem is that the Checkbox widget uses a regular

What kind of connection exists between innerRadiusRatio and thicknessRatio from GradientDrawable class?

99封情书 提交于 2019-12-02 19:47:23
Let's supposed we've got a ring with inner radius R2 and outer radius R1. According documentation: Inner radius of the ring expressed as a ratio of the ring's width.For instance, if innerRadiusRatio=9, then the inner radius equals the ring's width divided by 9 As I understand this means that innerRadiusRatio = 2*R1 / R2 . About thicknessRatio there is that: Thickness of the ring expressed as a ratio of the ring's width. For instance, if thicknessRatio=3, then the thickness equals the ring's width divided by 3 . So thicknessRatio = 2*R1 / (R1 - R2) . From this two equationі we can get this one:

Using layer-list to display some drawable images

梦想与她 提交于 2019-12-02 18:57:07
Android studio 2.0 Preview 3b Hello, I have created the following layout that I want to use for a background for my app. I am using the layer-list and I want to display a bowl of peas in 2 locations. Everything looks ok in the preview, but when I run on genymotion or some cheap Chinese devices the image stretches across the screen. However, on the Android AVD, everything looks fine and on my Nexus 5 (real device) everything works ok. This is what I want and this is how it's displayed in the AVD and Nexus 5. As you can see there is no problem. <layer-list xmlns:android="http://schemas.android

Are there any Android Drawable designers?

六月ゝ 毕业季﹏ 提交于 2019-12-02 17:26:08
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 iPhone has Opacity . So my question is, is there a designer or drawing tool for Android? Note: Other

How to set gradient drawable as backgroundTint attribute on FloatingActionButton

▼魔方 西西 提交于 2019-12-02 13:12:05
问题 I would like to use a gradient color instead of the traditional solid color for a Floating Action Button. I already know how to modify the background color of the button, using ColorStateList . Is there a way to implement the following drawable as a background tint color? overlay.xml <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#c25f82" android:endColor="#5a3e60" android:angle="-270" /> </shape> 回答1: Yes, you can

How to load icon from icon pack

喜欢而已 提交于 2019-12-02 12:54:46
问题 I want to use an icon from an icon pack. I know how to find installed icon packs. But I can't find out how to load an icon from an icon pack. Find icon packs - WORKS That's how I find icon packs: private static ArrayList<String> getInstalledIconPacks(String filter) { ArrayList<String> packs = new ArrayList<>(); List<ResolveInfo> infos = MainApp.get().getPackageManager().queryIntentActivities(new Intent(filter), PackageManager.GET_META_DATA); if (infos != null) { for (int i = 0; i < infos.size

How can i add sdcard images to coverflow?

允我心安 提交于 2019-12-02 12:13:02
Here is my coverflow with drawables :( This is my Image Adapter Code /** The Constant IMAGE_RESOURCE_IDS. */ private static final List<Integer> IMAGE_RESOURCE_IDS = new ArrayList<Integer>(DEFAULT_LIST_SIZE); /** The Constant DEFAULT_RESOURCE_LIST. */ private static final int[] DEFAULT_RESOURCE_LIST = { R.drawable.promo_blue_bg_medium, R.drawable.promo_green_bg_medium, R.drawable.flow, R.drawable.promo_yellow_bg_medium, R.drawable.promo_black_bg_medium , }; /** The bitmap map. */ private final Map<Integer, WeakReference<Bitmap>> bitmapMap = new HashMap<Integer, WeakReference<Bitmap>>(); private

Problem serializing Drawable

时间秒杀一切 提交于 2019-12-02 06:16:17
I've got a singe object which has three fields: two strings and a Drawable public class MyObject implements Serializable { private static final long serialVersionUID = 1L; public String name; public String lastName; public Drawable photo; public MyObject() { } public MyObject(String name, String lastName, Drawable photo) { this.name = name; this.lastName = lastName; this.photo = photo; } } What I'm trying to do, is to save an ArrayList of these objects to a file, but i keep getting a NotSerializableException 02-02 23:06:10.825: WARN/System.err(13891): java.io.NotSerializableException: android

Get drawable displayed size after scaling

佐手、 提交于 2019-12-02 04:31:38
here's my problem: How can get the displayed size of the drawable inside an ImageView in pixel after scalling, assuming that the ImageView size isn't equal to the scaled drawable? A lot of methods just return the original size of the Drawable or just the size of the ImageView. Here is a picture describing what I want : http://image.noelshack.com/fichiers/2013/06/1360144144-sans-titre.png 1 --> ImageView Size 2 --> The scaled image size that I want to get in px Thank you. From the image you posted I assume you have scaleType of FIT_CENTER (or CENTER_INSIDE with drawable bigger than imageView)