How to add gravity for button CompoundDrawable in android? - android-layout

I am developing android application with some custom views. Here i am adding buttons with CompoundDrawable in one of my view. Here i am giving CompoundDrawable for buttons to give bullets effect for the text. But i am facing problem with CompoundDrawable alignments.
If my button text is single line then alignment is showing good. Button text is more that 2 line that will show my bullet in incorrect place. At any way i would like to show my bullet CompoundDrawable at left-top of my button text.
Here is my button creating code
Button button = new Button(this);
button.setLayoutParams(myParams);
button.setCompoundDrawablesWithIntrinsicBounds(drawableId, null, null, null);
button.setBackgroundResource(0);
button.setGravity(Gravity.LEFT|Gravity.TOP);
But it is not showing my button what i would like to show.
I have attached image of my buttons. On that 1 is proper. but i would like to show 2, 3 also same like button 1.
Please look on attached image.
Thanks in advance.

make use of android layouts........

Related

Attribute inspector for buttons has no background color

Sorry but looks a simple question. In the attribute inspector menu of all my buttons the background color option menu/property disappeared in Main storyboard. I cannot change the color. I can change the text color, the shadow color, the background gives only the option of images but no color?? I rebooted xcode, and the MacBook as well.
I found the issue. On the attribute inspector at the very bottom there is the view section. On the right of the View there was missing "show" word, looks like a bug and that's why I have not seen that I could expand the view. Now that I expanded it I can hide and show with this right button and the keyword show is there again.

Adding button to layout and it will not show up

I'm adding a button to a linear layout and it does not show up. Main XML after adding button last button:
Preview button does not show:
I use AIDE as well, it isn't quite reliable. Nor is its Design preview. So, basically, if your codes are correct just build the app and see what happens.
There are no place for the third button.
Reduce string length in android:text of all buttons and check that button appears, or make linearlayout orientation vertical and check.
You must learn about "weight" attribute...

Vertical Radio Buttons

So what is the best method to get vertical radio buttons to display in situations with limited screen space. I started with the standard xp:radioGroup, but I can't control the format to be vertical.
I have tried the multicolumnradiobutton on OpenNTF, but I was having problems getting an eventHandler to fire to force a partial refresh (tried using onclick). Would love to see a sample of that since that would solve the issue of formatting.
What I am seeing at this point is if you use a radiobutton group you are stuck with a horizontal layout of buttons. I haven't looked Dojo Radio Button to see if it was the answer.
Basically best option for vertical list of radio buttons that will allow partialRefresh of document.
You get vertical radio buttons with xp:radioGroup when you set layout="pageDirection":
<xp:radioGroup
id="radioGroup1"
value="..."
layout="pageDirection">
...
</xp:radioGroup>
You can use a radio button (not a group) and tie them together with the name. Then you can format them any way you want. This is useful when using Bootstrap since the radio button group puts everything in a table.

fltk widget order, button is hide under another widget

I am using fltk 1.3.2.
I have two widgets, one of them is Fl_Multiline_Output and other one is Fl_Button.
The button is a place on the the multiline_output.
When I click multiline_output, the button is disappeared.
I need to use always on top like speciality for my button.
It mustn't be hide.
Does anyone know fltk support this?
I have changed Fl_Multiline_Output to Fl_Text_Display, I put the text and deactivated it. Now, when I click Fl_Text_Display nothing is happen.
I changed to Fl_Text_Display because if I deactivate the Fl_Multiline_Output object, text color is changed. I chose Fl_Text_Display there is no problem with text color.

In LWUIT, a white rectangular background appears when the button is pressed, how to remove it?

Using LWUIT, I have a Form (form1) which contains a Button (see the silver arrow at the bottom of the Form in the left image below). This Button is constructed using an image which has a transparent background to give the effect of a non-rectangular Button. When the Button is pressed it shows another Form (form2).
But unfortunately, when the user presses this Button, a white rectangular background appears for a few milliseconds in the background of the image. see the right image below:
The question is:
How may I prevent this white rectangle from being appeared after pressing the Button ?
You have modified the state of the button when it is selected or unselected. You also have to modify pressed style.
You can do it with button.getPressedStyle()
Try:
button.getPressedStyle().setBorder(null);
button.getPressedStyle().setBgTransparency(0);

Resources