drawable

Diagonal line across view

余生颓废 提交于 2019-12-07 16:31:22
问题 Based on some condition, I have to diagonally cut the list cell. For this I have made diagonal drawable image using this code: diagonal_line.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:top="0dp" android:bottom="0dp" > <rotate android:fromDegrees="315" android:toDegrees="315" android:pivotX="0%" android:pivotY="0%" > <shape android:shape="line" > <stroke android:width="10dp" android:color="@color/grey" /> <

Can handle events on irregular shapes on Android?

我与影子孤独终老i 提交于 2019-12-07 16:29:17
问题 As far as I know for now (which is little), all the Views in Android have square or rectangular shapes. This is fine almost all the time until you want - what I actually want - to create non-square shapes that could handle events. My goal is to have a circle divided in 3 sections of 120° each. Each section of the circle should behave like a button. The problem is that if we look at those 3rds of a circle and place them in a square box that strictly contains them, they are overlapping each

Android - Multiple colors & size in drawable shape style

▼魔方 西西 提交于 2019-12-07 16:06:44
问题 I'm trying to have a circle background for my TextView, so I created a shape style as below. But I need to have multiple colors with multiple sizes (while the textSize stays constant), so I need to set the width/height in the style. From my understanding..Layer List puts all the shapes on top of one another? Because I need to call it 12 times at different places, so it seems quite cumbersome to have 12 shape style xmls. Is there a better way to have all the different shape/size combinations

Drawable from mdpi loading instead of hdpi

拈花ヽ惹草 提交于 2019-12-07 15:53:30
问题 I have set up my project with different drawable directories (ldpi, mdpi and hdpi). I have a background png with two different resolutions: 320x480 in drawable-mdpi folder, and 480x800 in drawable-hdpi. Both have the same filename. When I try to load the background as a style in the manifest (using android:windowBackground in the style) if I use the emulator for a 1.6 device, I get the correct one loaded(mdpi). However, if I try this on my Nexus, I see that at first the correct background

calling setCompoundDrawablesWithIntrinsicBounds on multiple views with the same background gives inconsistent sizes

一世执手 提交于 2019-12-07 14:09:01
问题 I've got a LinearLayout with two EditText descendants (not direct children). I call EditText.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.xyz,0) on each to put a drawable (the same drawable) on the right side of each of the EditText s. The two edit texts are identical, except for their order in the ListView . However, the size of the drawable in the first EditText becomes larger than the second after adding the drawables. Specifically, the first EditText resizes to accomodate the

clickable drawable inside EditText in android

烂漫一生 提交于 2019-12-07 13:58:01
问题 I have an EditText with a drawable inside. I want to make the drawable clickable so that I can have a specific action when user clicks the drawable. How do I do that? My EditText is: <EditText android:id="@+id/phone" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="5dp" android:drawableRight="@drawable/question_mark" android:hint="phone number" android:imeActionId="@+id/phone_num" android:maxLines=

Image not appearing on HTC One M8

淺唱寂寞╮ 提交于 2019-12-07 10:54:29
问题 I'm currently developing a new app for the company I'm working at. We test this on multiple devices, now a strange thing I noticed the other day, well someone else did. My Colleague tested the app on his HTC one m8, and we have a background image on the login page but it didn't show for him. It did however on a Nexus 7, Samsung Galaxy Tab 4, Motorola G and Samsung S4. This might be very specific, but I guess some people must have noticed this kind of behaviour before on certain devices and

How to create android drawable consisting of two colors side by side?

亡梦爱人 提交于 2019-12-07 10:54:28
问题 Uisng XML is it possible to create a drawable where half of it would be color1 and another half would be color2? When I set that drawable as a background of a view it should look like in the image below. 回答1: Doing it by xml: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:right="100dp"> <shape android:shape="rectangle"> <size android:height="100dp" android:width="100dp"/> <solid android:color="@android:color/black"/

How do I add an image in the drawable folder to an ImageView in Android Studio 1.2?

╄→гoц情女王★ 提交于 2019-12-07 08:35:39
问题 Since Google added the mipmap folder for the launcher icons, I have had issues using the drawables folder. I manually added the hdpi folders in the drawable folder, but when I try and add the src path, the images won't allow me to view and select them. How do I add an image in the drawable folder to an ImageView in Android Studio 1.2? 回答1: try with this way of code there are three ways to set image on ImageView imageView.setImageResource(R.drawable.play); or <ImageView android:id="@+id

Android Drawable vs Asset in Image loading performance

旧巷老猫 提交于 2019-12-07 07:11:35
问题 I'm android developer from Korea My project has features about loading large amount of huge bitmap (about 2,000 x 1,500px) I had a some experiments to compare time complexity and space complexity between Asset and Drawable By result, Asset is better than drawable in space complexity. When I load huge images using drawable, my app broken down with OutOfMemoryException : the bitmap size exceeds VM budget but when I load huge images using Asset, It works fine! Anybody know reason why this