drawable

Deep copy of a Drawable

谁说胖子不能爱 提交于 2019-12-17 16:32:43
问题 I have an ImageView. In its onClick I get its Drawable: Drawable dr = ((ImageView) v).getDrawable(); And set it to a dialog's ImageView: zoomedImage.setImageDrawable(dr); But when I close the dialog or the activity is resumed. The image at the original position gets stretched and is shown larger than its size, leading to only a portion of the image is visible in the ImageView. Is this a case of deep copy or there is another problem? If it is, how can do I deep copy the original Drawable so

Android : Understanding drawable folder

折月煮酒 提交于 2019-12-17 15:58:06
问题 I have an image with dimensions 250*70 pixels under drawable folder (I'm just starting out in Android development, so i created drawable folder in res ) and I have the same image with higher dimensions in drawable-large folder; but the image is not looking as I expected. Can anyone explain the reason behind/purpose of 3 drawable folders? Where should I store my image so that it displays properly in both modes (landscape & portrait) and in all the mobiles (including tablets)? I want my image

Customizing tabs on state in Android

ぐ巨炮叔叔 提交于 2019-12-17 15:37:27
问题 I know how to put the icon on each tab, that is no problem. I also ran across this : [Stack Overflow thread on pretty much same thing][1] I followed one of the links from that question and found [this][2] Pretty much, it said to use a selector defined in the XML, sure, did that. But there is no id associated w/ it so I am not sure how to get the selector function as a drawable so I can use it as the icon for the tabs. Maybe I am going about this the wrong way. But this is what I have, and

Sub folders in drawable resource folder? [duplicate]

邮差的信 提交于 2019-12-17 12:05:10
问题 This question already has answers here : Can the Android drawable directory contain subdirectories? (20 answers) How to access res/drawable/“folder” (5 answers) Closed 5 years ago . I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that? Thanks. 回答1: This is now (sort of) possible by using Android Studio and Gradle. Whilst subfolders are

Sub folders in drawable resource folder? [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-17 12:04:42
问题 This question already has answers here : Can the Android drawable directory contain subdirectories? (20 answers) How to access res/drawable/“folder” (5 answers) Closed 5 years ago . I would like to create sub folders in drawable folder. I have a lot of file(such as png, xml) in drawable folder. I want to create sub folders in there to find the files easily. Can I create sub folders like that? Thanks. 回答1: This is now (sort of) possible by using Android Studio and Gradle. Whilst subfolders are

How to support all the different resolutions of android products

China☆狼群 提交于 2019-12-17 10:46:22
问题 All the different resolutions of the different Android products are driving me nuts. My first android app that I wrote was designed so it supported the three commonly used resolutions: 240x320 (LDPI), 320x480 (MDPI) and 480x800 (HDPI). The 480x854 didn't do any harm to the layout because it has the same width as 480x800. I've also bought the following devices to test my android apps on: Samsung Galaxy Europe (LDPI) HTC Desire Z (HDPI) Luckily my girlfriend has a HTC Wildfire S (MDPI) so I've

Half circle shape not work

时光总嘲笑我的痴心妄想 提交于 2019-12-17 10:25:32
问题 I try to create half circle background, in development IDE preview it works, but when I launch in emulator it doesn't work. Here is my shape code : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:height="50dp"> <shape> <solid android:color="@color/colorAccentDark" /> </shape> </item> <item android:top="-500dp" android:bottom="0dp" android:left="-100dp" android:right="-100dp"> <shape> <corners android:radius="500dp" /

Why isn't my vector drawable scaling as expected?

試著忘記壹切 提交于 2019-12-17 10:11:45
问题 I am attempting to use vector drawables in my Android app. From http://developer.android.com/training/material/drawables.html (emphasis mine): In Android 5.0 (API Level 21) and above, you can define vector drawables, which scale without losing definition. Using this drawable: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="@color/colorPrimary" android

What's the correct size icon for drawable-xxhdpi?

孤街浪徒 提交于 2019-12-17 10:09:53
问题 As we know, the correct sized icon: * drawable-ldpi (120 dpi, Low density screen) - 36px x 36px * drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px * drawable-hdpi (240 dpi, High density screen) - 72px x 72px * drawable-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px On Jelly Bean, drawable-xxhdpi can be supported. So what's the correct size icon? 回答1: MDPI: 48x48 HDPI: 72x72 XHDPI: 96x96 XXHDPI: 144x144 XXXHDPI: 192x192 to create an icon for different densities, you

How to use default Android drawables

☆樱花仙子☆ 提交于 2019-12-17 07:17:28
问题 What is the best approach when using default Android drawables? Should I use android.R.drawable or should I copy the drawables in my project and use R.drawable ? Is there any risk, that in a newer version of Android, some of the default drawables are removed or resized? Or, affect in some negative way, the look of my app? Also, which of the drawables in the Android source code are considered "stable" and should be relied on? I'd rather not copy the drawables because I think that the look of