273 questions
1 vote
1 answer
48 views
Drawable icon use square space instead of rectangle
I want to have a small button that has a three dots icon. I made the icon drawable : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas....
0 votes
1 answer
41 views
How to get the true colors of an android:icon to show through in a Button
I'm using this code: <Button android:id="@+id/play_pause_button" android:layout_width="match_parent" android:...
0 votes
0 answers
24 views
Custom Drawable causes Inflation Exception
I am attempting to create a Custom Drawable, but it is causing a Java.Lang.RuntimeException and Error inflating class android.widget.GridLayout when I try to use it. Here is the code: using Android....
1 vote
0 answers
473 views
XML drawable cut corner instead of round
Similar to the M3 cornerFamily feature, how to achieve it via XML drawables? Current code <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas....
-1 votes
1 answer
1k views
Android button border shape with cut corners
Is it possible to make a button (or any other element like image view or layout) with border shaped with cut corners like below: Preferably using xml-drawables with cut size taken from @dimen Edit: ...
0 votes
1 answer
201 views
External image added in android studio not working
I downloaded external images to the android studio into the drawable folder of res but when I select the ImageView to add the same image on the screen, the image is not located there. In the drawable ...
0 votes
1 answer
569 views
how to create a drawable for a splash screen background from 2 colors?
I'm trying to create a background for a splash screen from 2 different colors one on top of the other, each exactly half of the screen, like so: I have tried the following but it does not work for ...
1 vote
0 answers
82 views
Android How to prevent Drawable resizing to fill container
I have a drawable (just a red circle) <item android:state_pressed="false"> <shape android:shape="oval"> <size android:height="12dp" /> ...
1 vote
0 answers
51 views
Divide items evenly in <layer-list>
**I need a background like this ** 4 items need to be divided evenly and fill the whole screen. when I set width for the items, they cannot match the screen width.
1 vote
0 answers
422 views
How to set a background for ViewPager2 to have an image that will have rounded corners only on the left side?
My current implementation is to create a ImageView sibling element. If I use any of the aspect ratio-preserving scaleType other than centerCrop, the image only covers the ViewPager2 partially, which ...
0 votes
1 answer
346 views
how to Draw tooltip with border in android?
I am new to android and I wish to achieve a tooltip with border. Tooltip pointing to left. i.e: like below with text of choice. please help me with this, stuck with this for quite sometime now. I was ...
1 vote
1 answer
231 views
How to get drawable resources on FAB in Android
I am trying to use a FAB with Bottom NavigationView in my app. I have designed drawable xml resources for that FAB to give the FAB gradient color and an icon along with a drop shadow of custom color. ...
0 votes
1 answer
146 views
Changing colors of drawables in Android
I've made a function to change the colors of drawables in android. The problem is that it works only 60-70% of the times. I call it on the onCreate method of each activity of my app. (The color is ...
0 votes
1 answer
517 views
Rounded corners with background image for text view in android studio
I have a text view and and I want its background to be a image and also its corners rounded. I have tried that by creating a drawable file but the background image gets spilled out. <LinearLayout ...
0 votes
1 answer
219 views
Layer-list drawable is not rendered fully from time to time
I have encoutered problem where my layer-list drawable is not rendered fully from time to time. In my activity's onCreate I have programatically created few TextViews, in onResume I am calling web ...