Questions tagged [setbackground]

140 questions
79
votes
6 answers

How to solve java.lang.OutOfMemoryError trouble in Android

Altough I have very small size image in drawable folder, I am getting this error from users. And I am not using any bitmap function in code. At least intentionally :) java.lang.OutOfMemoryError at…
Utku Soytaş
  • 1,475
  • 2
  • 19
  • 30
52
votes
7 answers

set cornerRadius and setbackgroundimage to UIButton

I am trying to set cornerRadius of UIButton but I dont know how to do it. If I do like this: button.layer.cornerRadius = 5; works well, if I do like this : button.layer.cornerRadius = 5; [button setBackgroundColor:[UIColor…
user1570600
19
votes
3 answers

Android setBackgroundTintList on pre-lollipop devices

I'm working with FloatingActionButton. The user should be able to switch the FAB background color within a onClick Event. However, the recommended call to setBackgroundTintList seems to be only compatible from 21+ API. How do I - correctly - go…
Lampione
  • 1,622
  • 3
  • 21
  • 39
18
votes
3 answers

Android View background changes unexpectedly

I'm building an app that has plenty of screens. most of the screens have a View at the top with a background color. I often change that color using view.setBackgroundColor(color) Here comes the weird thing: sometimes after setting the color of one…
dors
  • 5,802
  • 8
  • 45
  • 71
12
votes
6 answers

JPanel setBackground(Color.BLACK) does nothing

I have the folowing custom JPanel and I have aded it to my frame using Netbeans GUI builder but the background won't change! I can see the circle, drawing with g.fillOval(). What's wrong? public class Board extends JPanel{ private Player…
c0dehunter
  • 6,412
  • 16
  • 77
  • 139
11
votes
6 answers

Why does setBackground to JButton does not work?

I have the following simple code: btn = new JButton(); btn.setBackground(backgroundColor) I worked when I used: UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"); But it stopped to work after I have commented…
Roman
  • 124,451
  • 167
  • 349
  • 456
8
votes
4 answers

How to set color using integer?

How can i convert color code in integer ex: 13369395 to android specific. Since 13369395 is also an integer i tried doing mainLayout.setTextColor(13369395); but its not working. I also tried converting 13369395 to hexadecimal…
Arun
  • 1,658
  • 1
  • 14
  • 21
6
votes
7 answers

setBackground(new color()); in java does not understand the given RGB value

I have a program with some gui, on the JFrame I set, setBackground( new Color(107, 106, 104) ); The issue is that I get a greyish color, but not the right one. If I check it in PhotoShop, it gives me the RGB values (126, 125, 123) Ps. I have tried…
JW_
  • 652
  • 1
  • 8
  • 22
6
votes
4 answers

Java JFrame background color not working

I tried using: frame1.getContentPane().setBackground(Color.yellow); But it is not working. Can anyone help me? import java.awt.*; import java.awt.Color; public class PlayGame { public static void main(String[] args) { GameFrame frame1 = new…
Exorific
  • 93
  • 2
  • 2
  • 6
6
votes
3 answers

Issue in setting the background color in pyqtgraph

I've got an issue when using the pyqtgraph module in python. When I put a white background color to a glscatterplot, the scatter dots just vanish. It is like if the color of background was added to the color of the scatterplot therefore everything…
ymmx
  • 4,769
  • 5
  • 32
  • 64
5
votes
2 answers

Setting a background color to my Blackberry application very basic!

This is my screen: final class GeneralExpenseViewScreen extends MainScreen { public GeneralExpenseViewScreen() { super(); LabelField title = new LabelField("TeamMate TEC | Expenses", LabelField.ELLIPSIS |…
delete
4
votes
1 answer

Background color and GTK Look and Feel

I'm having troubles setting the background color for JButtons. For example I get this when I do button.setBackground(Color.ORANGE) But when I disable the GTK Look and Feel it's ok. Another way to set the background? Thanks.
Marcos
  • 4,643
  • 7
  • 33
  • 60
4
votes
3 answers

Android how to get gradient effect on setBackgroundColor

Is there a way to get a gradient effect or a semi-transparant effect when setting the background color of a view? For example, this code: selView.setBackgroundColor(Color.rgb(240, 128, 128)); // light red highlights a selected view in a list…
Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
4
votes
2 answers

Why won't my background color display in JFrame?

I have two class files: Screen https://gist.github.com/3020101 JMain https://gist.github.com/3020107 I'm trying to get it to go fullscreen for 5 seconds and display the background (or, at this point, even the foreground) but when I run it it goes…
Ethan Pieper
  • 57
  • 1
  • 2
  • 5
4
votes
1 answer

How remove background image from UINavigationBar

I set UINavigationBar background image at root view controller, but i need to remove background image at detail view controller. With Obj-C I use this code: if ([[UINavigationBar class] respondsToSelector:@selector(appearance)]) { …
1
2 3
9 10