drawable

Custom Home Icon in Action Bar Sherlock

南楼画角 提交于 2019-12-20 10:22:53
问题 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? 回答1: This works for my situation, it replaces the default ic_launcher icon in the

Changing a divider with setDivider in a ListActivity without a custom ListView?

拈花ヽ惹草 提交于 2019-12-20 09:19:38
问题 I can't seem to get a customized divider, using a Drawable I've defined, to work when using a ListActivity and not creating a custom ListView . It almost seems like when the VM creates its own ListView for me, with the ListActivity , it uses a theme with the default divider provided; and if I try to provide one, no dividers appear in the ListView at all. I know that I can create a custom ListView using XML and define android:divider on that ListView , and this does recognize my custom divider

How can i add sdcard images to coverflow?

匆匆过客 提交于 2019-12-20 06:15:14
问题 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

Get drawable displayed size after scaling

无人久伴 提交于 2019-12-20 04:15:30
问题 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. 回答1: From the image

Add rounded corners to custom view

限于喜欢 提交于 2019-12-20 01:08:54
问题 I'm quite new to Android and i'm trying to draw on a custom view (with canvas). I've got some lines & rects there. The point is, that i now want to give the whole view rounded corners, but that doesn't work well, as i'm drawing on the view and my drawings are above the rounded corners, which were added through the ressources. Is there a possibility to add rounded corners, that cover the whole view? Best regards and thank's for any help! 回答1: I am not sure of your requirements. But you can use

about android Drawable getBounds return Rect(0, 0 - 0, 0)

坚强是说给别人听的谎言 提交于 2019-12-19 07:10:33
问题 i want get the bound of drawable but then i use getBounds or copyBounds method .they all return Rect(0, 0 - 0, 0). the code like this Drawable marker = getResources().getDrawable( R.drawable.tbar_single_pressed); Rect copyRect = marker.copyBounds(); Rect getRect= marker.getBounds(); then the result copyRect is Rect(0, 0 - 0, 0) getRect is also Rect(0, 0 - 0, 0) why? the marker is NOT null and i have the res tbar_single_pressed.... thx 回答1: Drawables don't have dimensions unless they've been

How to make bottom border in drawable shape XML selector?

 ̄綄美尐妖づ 提交于 2019-12-19 05:34:13
问题 I'm trying to create a drawable shape with different states for my button. So I wrote this: <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="true" android:color="@android:color/black" > <shape android:shape="rectangle" > <solid android:color="@color/NEGATIVE_pressed" /> <stroke android:width="1dp" android:color="@color/ORANGE" /> <corners android:radius="4dp" /> </shape> </item> <item android:state_focused="true" android:color="@android:color

Dynamically show images from resource/drawable

偶尔善良 提交于 2019-12-19 04:06:00
问题 I'm trying to put different images (.jpg , .png) dynamically into a ListView from r es/drawable . The names from the images I get from a database. The images themselves are in the res/drawable folder. This is what I already have, With an error of :D String imgName; --> There are the img names I need from the database Drawable drawable; drawable = Class.appContext.getResources().getDrawable(Class.appContext.getResources().getIdentifier("com.example.test:drawable/"+imgName,null,null)); Then I

Android HTML resource with references to other resources

孤人 提交于 2019-12-19 03:43:11
问题 I would like to add an HTML resource to my Android project with references to other resources (mainly drawables). Where should I put it and how do I reference other resources from it? Is there a particular way to pass the HTML resource to a WebView ? Thanks! 回答1: The html file goes into the assets folder in root (as a sibling folder of res), as well as all the drawables. You can view it by doing something like webView.loadUrl("file:///android_asset/filename.html"); 回答2: If your file is on the

How to convert the LayerDrawable to Drawable in Android?

雨燕双飞 提交于 2019-12-19 03:18:48
问题 In my app i use the LayerDrawable to display overlayer image.and i do this is successfully use of layerDrawable. after i get layerDrawable set as a imageView.setImageDrawable(layerDrawable); Now i want to use this image drawable take as Bitmap and use in next imageprocessing. but when i try to get the Bitmap use of this ((BitmapDrawable)imageLayout.getDrawable()).getBitmap(); i got the following Error. 04-04 12:56:02.102: E/AndroidRuntime(15127): java.lang.ClassCastException: android.graphics