drawable

Why can't file names in the drawable folder contain special characters or start with a capital letter?

眉间皱痕 提交于 2019-12-01 16:27:36
Is there a point to these rules? Each file inside folder is translated into java field name inside R.java class: drawable\icon.png -> R.drawable.icon Hence the reason for not using special characters inside file names, as they can no be used in Java names. As for capital letters, I guess that's to avoid one little problem in Windows vs. Linux environment. That's because Linux thinks that Icon.png and icon.png are different files, and Windows thinks that Icon.png and icon.png is the same file. So anyone using Linux can create application that is not compilable on Windows. You can see some

Android: drawable resource with numbers. Is it possible?

大城市里の小女人 提交于 2019-12-01 16:19:35
问题 I would like to know if i can, somehow, create a drawable resource (png for example) called 787.png. Because Eclipse wont let me compile the project unless i modify it. Thanks in advance. 回答1: The reason you can't have a resource with a numeric name is because variable names cannot start with numbers. For each resource, there is a generated constant variable (in R.java) with the resource's name. If you look in your Eclipse project, under the "gen" folder you will see R.java It is my

ImageButton does not display a particular drawable

蓝咒 提交于 2019-12-01 15:33:10
This is rather a funny problem I have ever come across, I have a table layout with 9 image buttons, 3 per row. Every ImageButton has a different image associated with it. I have set the background of the image button to transparent (#00000000). Now here is where the funny stuff happens, One of the images doesn't show up on the emulator (Gingerbread) as well as a device running Froyo. The layout editor shows all the images in place. Here are some more stuff: I used a RelativeLayout instead of a TableLayout , the same issue persists. I changed the position of the image (used it on different

Android Drawable Drawing Performance?

纵饮孤独 提交于 2019-12-01 14:51:57
In my view I have a simple ARGB drawable that takes about 2ms to draw but I can draw the same file as a bitmap in under 0.5ms (just some quick code, I can't really consider it an option). What are the best ways to optimize the drawing speed of a drawable? Andrew It will depend on the number of drawables and how many times each gets drawn. For a small number, use canvas (an exact number will also depend on the device) I would suggest using Canvas as it's a nice higher level approach to drawing. If you want to crank out a lot of images (think hundreds), I would suggest creating a GLSurfaceView

ImageButton does not display a particular drawable

浪子不回头ぞ 提交于 2019-12-01 14:28:13
问题 This is rather a funny problem I have ever come across, I have a table layout with 9 image buttons, 3 per row. Every ImageButton has a different image associated with it. I have set the background of the image button to transparent (#00000000). Now here is where the funny stuff happens, One of the images doesn't show up on the emulator (Gingerbread) as well as a device running Froyo. The layout editor shows all the images in place. Here are some more stuff: I used a RelativeLayout instead of

Android screen size resolution

断了今生、忘了曾经 提交于 2019-12-01 13:28:38
问题 My app works perfectly in resolution 480x800. If I keep the 480x800 resolution but change the screen size to for example 2.7 inches, 3.7 inches or 5.4 inches it still is perfect. But when I change the resolution to for example 640x1066 all the ImageButtons is too small and in the wrong place in all screen sizes... I have created ImageButtons in all four folders(drawable-l, m, h, xh) but still the buttons is not in the correct size.. <ImageButton android:id="@+id/ib1" android:layout_width=

Android Drawable Drawing Performance?

こ雲淡風輕ζ 提交于 2019-12-01 12:58:09
问题 In my view I have a simple ARGB drawable that takes about 2ms to draw but I can draw the same file as a bitmap in under 0.5ms (just some quick code, I can't really consider it an option). What are the best ways to optimize the drawing speed of a drawable? 回答1: It will depend on the number of drawables and how many times each gets drawn. For a small number, use canvas (an exact number will also depend on the device) I would suggest using Canvas as it's a nice higher level approach to drawing.

Textured Line in CG

ぃ、小莉子 提交于 2019-12-01 12:42:07
I am working on a Drawing App for iOS. In this app i need to draw textured lines. For this i am using this method .But texture is so small and not in shape. I want to know what i did wrong and how can i resolve it. Here is my updated code- CGPoint mid1 = midPoint(previousPoint1, previousPoint2); CGPoint mid2 = midPoint(currentPoint, previousPoint1); [curImage drawAtPoint:CGPointMake(0, 0)]; CGContextRef context = UIGraphicsGetCurrentContext(); [self.layer renderInContext:context]; CGContextMoveToPoint(context, mid1.x, mid1.y); CGContextAddQuadCurveToPoint(context, previousPoint1.x,

Android resources “best match” fallback logic

折月煮酒 提交于 2019-12-01 11:08:40
I've read the docs about Android Resources and I think I've understood the best-matching logic used by android to identify in which directory a particular resource should be searched first.. Supposing that drawable-hdpi , drawable-en-port and drawable-en* match the current device configuration, drawable-en-port is the best matching directory.. My question is, if a drawable is not found in drawable-en-port , does the system look directly in drawable or does it look in the second-best-match drawable-en and then in the third best match drawable-hdpi and so on until it reaches drawable ? I suppose

Textured Line in CG

喜你入骨 提交于 2019-12-01 10:35:29
问题 I am working on a Drawing App for iOS. In this app i need to draw textured lines. For this i am using this method.But texture is so small and not in shape. I want to know what i did wrong and how can i resolve it. Here is my updated code- CGPoint mid1 = midPoint(previousPoint1, previousPoint2); CGPoint mid2 = midPoint(currentPoint, previousPoint1); [curImage drawAtPoint:CGPointMake(0, 0)]; CGContextRef context = UIGraphicsGetCurrentContext(); [self.layer renderInContext:context];