Android UI: Button with shape inside? - android-layout

I need to create a button that looks like this:
button
I was hoping to create it without using images. To create the pink part, I wanted to use a drawable.
How can I include a shape drawable within a button?

You can create a Layout, set background color for that layout as you wish. In that layout add two textviews. Set background for one layout pink. add another under the first textview. Then you can set onClickListener on layout. It'll work same as that of button and it'll be easy to change colors and text programatically.

Try using an ImageButton and setting android:src to point to your ShapeDrawable resource.

Related

tvOS button background color issue where it's not set properly

As you can see, I'm trying to set the button's color to a very light blue, but by default everything but the bezels are being darkened. Is the default button behavior causing this? Is there a workaround besides creating your own button? If I do have to create my own button, how can I reuse the default button's animation behavior? Thanks.
You don't have to create a custom button.
Instead, create an image containing the color you want and use that as a background image. Plus make sure to set the button's background color to default (clearColor), otherwise you will lose the rounded corners.

Android Studio - How to change layout

In Eclipse, I can right - click on my layout (say LinearLayout) and click on Change Layout
In Android Studio, I dont see anything like that. I do see Morphing but that will now show up at all times. For example, if you create simple HalloWorld with RelativeLayout, if you right click on that Layout while in Graphical mode, Morphing will not show.
If you right click on a widget in that layout, Morphing shows but to change widget type, not layout type.
If you want to change the Layout, you can do Two things:
OPTION 1
1. Simply click into your Xml file and select the "Text" option at the bottom on your screen
2.Change to layout
OPTION 2
1.Just drag another layout in Design and put your items in it, delete your old layout PS. you can have layouts in other layouts
Hope I helped!
In Android Studio 3.6.3 the easiest way to change the Layout is to right-click on the layout in your Component Tree and click Convert view….
The other option is to delete this layout and create new activity layout with type you want to be.
You also can use AbsoluteLayout, just change RelativeLayout to AbsoluteLayout in activity_main.xml. With AbsoluteLayout you're more "free"

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.

Change command menu background in LWUIT

Can we change Command's background color of the menu in LWUIT ?
and how can I set an icon to the "Menu" generated Command ?
thanks
I will try to explain better than the other post. You can change the style of the Menu using and UIID.
There are two ways to do that.
Easy way. Use the LWUIT Resource editor and create in the Unselected tab, and UIID called Menu. In this UIID you should configure the background color as you wish. You can change more things (like text color, size of the font, etc)
Hard way, by code. Create a Style object and set it to the Menu.

How to remove the dark shadow of the screen when a Dialog is shown?

When a Dialog is shown then the background of screen is darkened. I want to remove this darkness so that the screen looks like normal. How to achieve that ?
When you show a Dialog the background becomes a Form, changing its style you can modify the background of a Dialog. I don´t really know if you can make this Form transparent. I use the LWUIT-Theme creator and modifiying the Form´s style, I can change the background for an image o for one colour.
Try it here!
http://lwuit.java.net/
Set the tint color of the parent form, you can also set this in the look and feel class and within the theme constants in the resource editor.
just add below code on your dialog:
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

Resources