Adding Image button after Add button is clicked (Android Studio Java) - android-studio

Is it possible in Android studio to produce an Image Button after I clicked a button like Add Button. If yes, how? I want to make an attendance app wherein if the user clicks Add Class an image button will appear

We have no idea of which layout of you are using as the parent. But, for the best results of my answer, linear layout is advised.
The thing you are trying to achieve is trying to create dynamic elements.
For this, you can create an instance of the ImageButton class and then add it to you layout. This can be dont as follows:
//inside onclick of the add button
ImageButton newView = new ImageButton(context);
parentView.addView(newView);
You can add customisations to the view before adding it to the view.

Related

How to create a pop up in hybris backoffice?

I am trying to create a popup message in the Backoffice PCM. In particular, from within the editor area of a product. From the editor a user can click on the assortment view or compare view buttons on the side toolbar to change screens (redirect).
I want to give the user a popup to inform them that any changes will be lost.
Any ideas on how to accomplish this?
I have tried to create my own widget and wiring my custom widget to the ootb pcmbackoffice-toolbar but have not been successful.
It's possible to display a simple popup via the ZK framework (the framework used by Backoffice). From the backoffice code you can open a popup like this:
import org.zkoss.zul.Messagebox;
public void someMethod() {
// do some actions...
Messagebox.show("Some Messagetext", "Info", Messagebox.OK, Messagebox.INFO);
}

how to remove default graphic assigned to a control (like buttons and checkboxes) before setting new graphic to that control in java fx scene builder?

i am making a java desktop application using javafx. For gui building i am using scene builder 2.0.
Everything is just perfect as expected just 1 thing. I want to customize the buttons. i want to assign a custom graphic to a button.
When i use [button.setgraphic(node)] , this statement set the new graphic to the button but default graphic of button also remains present as well.
I just want to remove the default graphic and then want to assign the new (custom) garaphic to a control like buttons and radio buttons in javafx. 1 thing again i must tell that i am using scene builder for building gui.
How can i achieve this ?
thanks in advance....
Below is the screen-shot of current occuring situation, .....
Here i have made a button using javafx scene builder , and then in the controller of the fxml file (.java file) i am trying to set the image (shown in orange box in snapshot) to that button by using setGraphics property of button ..... i just need that button to be of following shape ...
You'd better customize your button via CSS. Here goes tutorial. What you are trying to do is to modify button picture (which is empty by default). I guess this wasn't your exact purpose.
button.setGraphic(null)
// worked for me.

How to add an view on top on activity layout dynamically which automatically shifted the old view down

I am working on an App in which I have an icon on Action Bar.When I click on this Action Bar icon then an EditText should come on the top of layout(below Action Bar) and all of the other data on layout should shif down.I am using Relative Layout.
I know how we can dynamically add view in relative layout.But here I have to add item on top on layout, while there is also some view on top before clicking the icon.
Try the below if it works for you, this is what you'll need as per my understanding of your question.
EditText et = new EditText(this);
empty.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
et.setText("Dynamic EditText!");
et.setMinLines(1);
et.setMaxLines(3);
relativelayout.addView(et);
// assuming you already have your relative layout and the rest declared.

How to create HyperLink in LWUIT

I want to create a hyperlink using lwuit and i want to show it on myForm Screen?when i click on the link,it should navigate to the link,i have tried this for LCDUI,I got the result,but i dont know ,how to do it using LWUIT?
There is no specific control for hyperlink in lwuit. But, we can create hyperlink look using buttons.
Button btnHyperlink = new Button("Hyperlink");
btnHyperlink.getUnselectedStyle().setBorder(null);
btnHyperlink.getSelectedStyle().setBorder(null);
btnHyperlink.getUnselectedStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM,Font.STYLE_UNDERLINED, Font.SIZE_MEDIUM));
btnHyperlink.getSelectedStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM,Font.STYLE_UNDERLINED | Font.STYLE_BOLD, Font.SIZE_MEDIUM));
btnHyperlink.getUnselectedStyle().setFgColor(0x0000ff);
btnHyperlink.getSelectedStyle().setFgColor(0x0000ff);
To navigate to another link when click the button, write the navigating code in button's action listener.

adding buttons dynamically in android

I'm new to android development and needs help here.I want to create a layout where buttons are added dynamically.In this the no of buttons to be added are decided on the fly.(at run time) i.e depending upon the number return by server i want to add buttons.below is the layout i want to create.Please suggest me suitable solution.I was trying creating this layout with table layout.Thank You
http://i.stack.imgur.com/tbrEq.jpg
Read in your array of buttons and initialize your empty layout (i.e. setContentView). Then, create your buttons using the ImageButton constructor and call .addView(btn) from the layout where you want to insert the button. Don't forget to set any layout parameters you need.

Resources