Questions tagged [setbackground]
134 questions
0
votes
1 answer
setBackgroundImage on TabBar does not work when tapping items
I can set the background once, but after that it never changes again. I've seen all examples on stackoverflow. The code examples look always the same. I've set the delegate. The images are all ok. I've set them one after the other as default image…
rockstarberlin
- 1,833
- 1
- 18
- 31
0
votes
2 answers
Set imageview background on button click?
lets say I have a timer activity. Theres an image view that displays a number of 0 - 9(these are viewed as images, NOT text).
eg. the images names are clock_0, clock_1, clock_2...clock_9.
There is a plus and minus button that should change a…
borislemke
- 6,954
- 4
- 34
- 49
0
votes
2 answers
UIButton to show BackgroundImage, Image and Title
I want to create a UIButton that uses its setBackgroundImage, setImage, and setTitle properties, but when I add setTitle in combination with setImage and setBackgroundImage the title doesn't appear.
I've tried the following.
[button…
Alice Chen
- 231
- 1
- 2
- 11
-1
votes
1 answer
I want to have a list of images to display randome, which is the best way?
I want to have a list of images that will be displayed in the background of a button randomly every time I click it.
Which is the best way to do it? I assume that not with an array since it has same size since it's initialized, and I think that I…
PstrTms
- 21
- 3
-1
votes
1 answer
Issue with setBackground(): the drawable seems to be applied to the parent, not to the view
I have developed a custom view that extends the View class:
public class ScRectangle extends View implements Parcelable{ ... }
I also have created the following Drawable:
ema3272
- 877
- 2
- 10
- 24
-1
votes
1 answer
How to change border/background color for android gallery
I created a simple gallery following a tutorial.
Everything works fine but i wasn´t able change the border/background color.
Maybe a small image helps to understand my Problem.
desired colorchanges
I get a scaled image with a dark grey filled…
Thomas
- 1
- 2
-1
votes
2 answers
How to change the background color of JLabel?
Here's my program:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FinalsLabExam extends JFrame implements ActionListener,
MouseListener {
JLabel labelMc = new JLabel("McElvin R. Liceralde",…
Blade Matrix
- 7
- 1
-1
votes
1 answer
Change image background for Each Screen in Android
I'm still new with android so please explain as careful as possible and preferably with example code. I'm currently working on fact finder app that simply displays a new fact when the button is clicked. Every time a new fact is displayed the same…
Kharl Mccatty
- 25
- 3
- 8
-1
votes
1 answer
Android setBackgroundColor crashes application
This is a piece of code that is working for setbackground color tabwidget
mTabHost.getTabWidget().setBackgroundColor(Color.parseColor("#FFFFFF"));
However when I used different value of HEX: #FFC905, the application crashes.
What am I doing wrong?…
woninana
- 2,959
- 9
- 36
- 63
-1
votes
1 answer
JButton.setBackground function doesn't work properly
This is my code actually.
JButton but = new JButton("=");
but.setOpaque(true);
if (but.getText() == "=")
{
but.setForeground(Color.WHITE);
but.setBackground(Color.BLUE);
but.addActionListener(listen);
but.setPreferredSize(new…
gillioa
- 21
- 3
-1
votes
1 answer
Make random JTextField Yellow
I have 9 textfields in my design that are named box1,box2 etc. I want to make one of these yellow. So i did put the names of the textfields in an array and tried to use the Random function to pick one of these names. But it doesnt work.
String[]…
SindiSindi
- 21
- 5
-1
votes
1 answer
How to set the background in a JPanel without using the super call in paintComponent()
In this program, I want to draw a series of lines that interact to form a web. Each time the timer ticks, a line is drawn. Therefore, I cannot have the super.paintComponent(g) call in the paintComponent() because I need the previous lines to appear.…
Grusha Prasad
- 7
- 1
-2
votes
1 answer
Android: setBackgroundResource not updated properly
I am using 2 LinearLayout and 2 buttons each inside the Linear layout. When i do a particular operation i need to change the background resource of the Linear layout and change the text of the button inside these layouts.
I use the command…
Kiran k g
- 726
- 8
- 17
-2
votes
2 answers
How do I set the background of an xml on click in Android
Here is what I want to do: I click on a button which opens and activity that changes the background periodically.
My code looks like this:
RelativeLayout relativeLayout;
protected void onCreate(Bundle savedInstanceState) {
…
Baxter Stockman
- 43
- 6