Change EditTextPreference widget color in XML? - java

I have been having a tuff few days with the EditTextPreference object. No matter which emulator I use this on, it seems to change color slightly but always makes my text the same color as the widget itself. (Yes, I know it's not really a widget).
I can change the TEXT color and the BACKGROUND TEXT color in the XML code, but this does not help because the "CANCEL" and "OK" confirmation buttons (which are part of the widget)to tap are yellow and impossible to see on the white widget background.
Is there any way in XML to make this widget a different color? This has been very frustrating.

You can set background colour of any widget by property
android:background="#ffff00"
enter any hex code at place of #ffff00
You can pick up hex code from here
you can also set a picture as a background of widget
android:background="#drawable/your_image"
place your_image in drawable folder

Related

How can I keep or change the navigationBar color?

I have developed an android application, there is a picture in the foreground. When I click on the picture, I make the background change (white if it is black, if it is black it will be white) at the same time I want to change the statusBarIcon color. and for that too
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
I use. In this way, the color of the statusbar icons is gray exactly as I want, and then I want to change the color of the icons to white.
getWindow().getDecorView().setSystemUiVisibility(0);
I am executing this command. everything is normal until here.. but when I do this, the color of the navigationBar icons also changes. How can I keep it or I want to change the color of the icons on the navigation bar
You can do it inside styles.xml using
<item name="android:navigationBarColor">#color/theme_color</item>
If you want to do it in code use
window.setNavigationBarColor(#ColorInt int color)

Change the checkbox style in codename one

I couldn't manage it to customize the style of a checkbox component. The image for the selected state doesn't get shown when the application runs. I already set the border types to "Empty" for each relevant state. Did I miss something?
example image for the selected state
checkbox component in gui builder
First off you should look at the OnOffSwitch component and check it out in the component gallery as it looks exactly like what you are trying to accomplish.
You are customizing the components background not its state image. The state image is a special case image in the case of a check box that can be customized via theme constants and changes based on selected state. The background is unaware of those states, selected in this case is a synonym for focused...

How to give a JButton both an ImageIcon and background color?

Is there a way to do both
button.setBackground(Color.green.darker());
and
button.setIcon(new ImageIcon(buttonImg.getScaledInstance(15, 15, Image.SCALE_SMOOTH)));
so that both the image and the background color are visible? Is there some sort of transparency setting on the button's image that I'm missing? Any help would be greatly appreciated.
EDIT:
Here is the image I'm trying to use. As you can see, it has transparency.
http://www.clipartlord.com/wp-content/uploads/2013/09/bomb3.png
What I am trying to get is the image to show up on the Button with the background color of green filling in the transparency. Right now when I try to do it, if I add the image at all, the background color is not visible whatsoever. But if I don't add the image, the background color is visible. I hope this helps.
Probably the LookAndFeel does not support what you want to achieve. Here is an image from the meta theme, on the left, and osx aqua theme.
If you want all of your JButton backgrounds to change you can try using a LookAndFeel that supports changing the UI. Unfortunately the aqua them does not let you change the default background for a button even using the UIManager#set
If you only want to do one button, you can change the button UI.
button.setUI(new BasicButtonUI());
That one doesn't look too nice, you can set the UI to one from another LookAndFeel,
button.setUI(new MotifButtonUI());
(Also doesn't look very nice, but now it buttons.)
Finally you can also create your own ButtonUI, or do some custom painting.

How can I hide the title bar in an android application

I have been trying to find a way to hide the title bar in my android application.
I used #android:style/Theme.NoTitleBar.Fullscreen in the android manifest. It worked but the background gets set to black and all the text views get set to white. Is their a way to have the background set to white and text to black without having to set them all individually?
For a simple version, try to use Theme.AppCompat.Light.NoActionBar. This will keep "light" theme but remove action bar.
You can ovveride the Theme.NoTitleBar.Fullscreen background color/text colors by applying additional styles. For example if you wanted your background color to be white you would apply the style:
#color/your_background__color

libGDX, Scene2d Button status

Hello I have some questions for adding images for a ImageButton.
I have an icon for example a play button now if I hover over the button it just should get a blue surounding box the inside Image should not change.
Should I draw for every icon the two states or are there other options.
If an button is not clickable it should get Grey. Same how to do this? Add an additional Image to every Icon?
For what is the Checked drawable in the ImageButton?
ImageButtons have a drawable for their background (up, down, over, etc.) and a drawable for the image on top of the button (imageUp, imageDown, imageOver, etc.). The only ones you must provide are up for the background and imageUp for the icon. These are the defaults used when you leave the other states null. But for visual reasons, you need down for the background or it will be hard to tell if the button is being pressed. It's up to you whether you think you need to also change the icon appearance with an imageDown.
All you need is to add the background drawable for disabled. If you want the icon to also turn gray, you need to create a gray version of the icon and assign it to imageDisabled.
The Buttons in Scene2d all support toggle functionality. When you press it, it will toggle to the checked state, so you can use the checked drawable to change its appearance while it is stuck down. If you don't want that to happen, leave the checked drawable null.

Categories