Questions tagged [background-drawable]
13 questions
126
votes
12 answers
Changing the background drawable of the searchview widget
I'm trying to change the drawable that sits in the Android actionbar searchview widget.
Currently it looks like this:
but I need to change the blue background drawable to a red colour.
I've tried many things short of rolling my own search widget,…

Martyn
- 16,432
- 24
- 71
- 104
19
votes
6 answers
How to have a Fullscreen Background Image (with center-crop) that doesn't Resize
I'm trying to set a photo as the background of an Activity. I want the background to be a full screen image (no borders).
As I want the image to fill the entire activity's background without stretching/squeezing (i.e. unproportional scalings for X…

user1987392
- 3,921
- 4
- 34
- 59
5
votes
3 answers
How to fix cut-off custom SearchView background in landscape?
I've followed the great answer for this question to make the SearchView widget in my ActionBar fit a custom theme. It works just fine for portrait mode, but in landscape the OS will shrink the height of the ActionBar to maximize content screen…

Chris
- 3,192
- 4
- 30
- 43
3
votes
3 answers
How to change TextView's background color dynamically?
I have reffered this question and implemented circular background for TextView using circle.xml (in res/drawable) and setting it as android:background="@drawable/circle" for TextView. But what I need is , I need to set the background color…

dev
- 1,085
- 4
- 19
- 26
2
votes
3 answers
Rounded corners drawable via code
I have a drawable that will change colors sometimes, but it must ALWAYS have rounded corners. It's for a UI library, so I can't know what colors will it have. XML is not an option, I have to achieve this with pure java.
Is there a way to achieve…

Charlie-Blake
- 10,832
- 13
- 55
- 90
1
vote
1 answer
how can I set drawable background just to a number string into another string in android?
is there any way to set background (xml circular drawable) to a number or any string between another string ?
I have (for example) this text in the textView (copied from stackoverflow):
You are setting the text on bookDisp(I guess that this is the…

Simon
- 147
- 2
- 10
0
votes
1 answer
Use different style for same item for different activity in android studio (Please read description)
I am working on a project wherein I want to use BottomSheetDialog in different activities. But for different activities I want the Dialog to have diffrent background drawable. I have set the background drawable in themes.xml but that makes the…

SIDDHARTH SINGH
- 138
- 3
- 8
0
votes
1 answer
android widgetProvider : set backgroundDrawable for button
I am trying to set background for button (a homeScreen Widget) through a configuration activity.
background color is accepted from user (from a JSON)
using that color, 2 GradientDrawables are prepared and added in StateListDrawable.
I want to set…

Uday Hegde
- 1
- 1
0
votes
0 answers
Performance issue while changing Background of a Relative layout Dynamically
I am trying to create a screen where i can select multiple images from SDCard and load them in to ViewPager & Gridlayout like how in WhatsApp Sending Multiple images (like in the below screen shot).
I am able to achieve like in the screen shot by…

Raj
- 1,843
- 2
- 21
- 47
0
votes
2 answers
Buttons text is not aligned any more after changing the BackgroundDrawable
i am changing my buttons' backgroundDrawable programaticaly:
myButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.card_button_blue));
After changing the background, the text in the button is not aligned any more like it was before…

Dusan
- 3,284
- 6
- 25
- 46
0
votes
1 answer
Import both R (android.R and .R)
I'm using custom background in my app. What i'm looking for is how to get default drawable from android.R. This because if a user select white or dark background, i don't wanna use a custom image, but use for ex:…

Stefano Munarini
- 2,711
- 2
- 22
- 26
0
votes
0 answers
How to resize image height based on the parent layout content height dynamically?
I have a parent layout with android:layout_height="wrap_content" and in my class code, it should set the layout background from a specific image, but the image height is bigger than the content height. I wanted to resize the image height of the…

Compaq LE2202x
- 2,030
- 9
- 45
- 62
0
votes
1 answer
Do SetBackgroundDrawable load image in memory?
i'm making an Android application, and i had some problem in report with "out of memory exception", after many search on the net, I found that android:background was loading background image in memory.
so i'll remove all my "android:background"…

theMouk
- 595
- 1
- 7
- 21