I want my users to choose something in one of my screen but i'm tired of the spinner. Can anyone suggest how can i add a cooler way to choose stuff?
If you're tired of a spinner, why not create your own styled dialog to select things. You can make it look however you want.
If you don't have too many options and/or they are labeled with short texts, you can consider using RadioGroup with radio buttons. This would of course go either directly on your activity (taking more space than a spinner) or inside a custom dialog.
Related
I have to create number of buttons and textbox, etc. depending upon a certain number. For ex: if the number = 5, I need to create 5 buttons, and if its value is 10, I need to create 10 buttons.
To achieve such a functionality, the conventional xml GUI won't make it up. I need to develop the GUI dynamically. How can I do that?
Take a look at RecyclerView. You need to apply the DataSet (what u receive dynamclly) and then let the Adapter handle all of the Binding.
Take a look at this tutorial, there are many more.
Notice that you will need to create TWO Viewholder (button and a textview) and override the getItemViewType
Add a Linear/Relative layout in xml and on run time according to given number add view(buttons and text views) in this layout.
See this tuts:
https://androiddesk.wordpress.com/2012/08/05/creating-dynamic-views-in-android/
http://www.javacodegeeks.com/2012/09/android-dynamic-and-xml-layout.html
how can I create (with JAVA) Combobox that contains Checkboxes for multiple selection and display the selected items in the Combobox like this picture:
click to see the pic
and thnx for advance.
EDIT:
I found this API (JAPURA API) and it's great but when I select multiple things I want to display the selected items instead of "* multiple items *".
Here's the link to achieve your goal:
JComboBox Providing a Custom Renderer
I would suggest you create a JButton and style it in the form of a Combobox if you want that.
Then, at the onclick function (actionperformed), you create a JPanel and make it visible under the button. In the panel, you can put whatever you want, so you just put checkboxes there.
I know this is kind of a workaround of your problem, but it should be easy for you to do so, and the actual user does not see a difference at all.
Hope I could help you.
Cheers,
Lucky
i have a couple of questions about activity's
i have a activity which i want to create some options for it. for eg. i want the user to be able to change the font size of text views.
i am a noob in java and eclipse. first i thought i can change the xml values via java but then i found out that i can't and they are read only.
so what is the best solution for creating options which are visual like changing colors and font sizes and picture through entire project?
for eg. i have 10 activities and inside each activity i have some text views. i want to change all of the font sizes. in xml you can create a dimen and all of the text views with android:fontSize:"#dimen/example will have the same size. but in java it takes more code and time.
what should i do ? couple of examples would be nice
thanks in advance
so what is the best solution for creating options which are visual
like changing colors and font sizes and picture through entire
project?
Have a look at the setTextSize() method of the TextView class. This will let you set the size of the text programatically.
setTextColor() will let you change the color.
setTypeFace() will let you change the font.
Having said that about TextView, it applies to all the subclasses of TextView like Button, EditText, etc.
i have a activity which i want to create some options for it.
I suggest you create a singleton instance that encapsulates all the information to change the visuals of your activities like text size, typeface, etc. This instance should then be shared among all of your Activitys.
couple of examples would be nice
No, an SSCCE would be nice. We need to see what you have tried. Code or you didn't do prior research.
I am trying to make a "Oregon Trail" like game with JAVA for my Computer Science class. It's all going well so far, but I would like some suggestions on ways of doing the following:
The words at the bottom "Health", "Stats", etc are buttons. I was wondering what the best way of making those buttons present information would be. Is there a way I could show them in that information in one of the bottom squares, and when a different button is clicked change the info to that one? Or would it be best to have popup frames to display the information?
IMHO, I'd go with display the content or info of the button in the panels above.
It keeps the information together in a single place and generally makes it easier to manage, no disappearing windows behind other windows for example.
You have any number of options depending on the information you want to display. You could simply use a none editable JTextArea if the information is just text, or a JList if you want to list items if the data is more structured, a JTable and even a JTree if you want to group the data into some kind of groupable hierarchy.
You could use combinations of each, based on your needs
I'm working on an app in JFace. So I have a CTabFolder with a number of CTabItems in it. What I would like is to be able to automatically switch to display an arbitrary CTabItem.
What I'm thinking is something like:
CTabFolder myFolder = FolderFactory.newFolder();
myFolder.showItem(myFolder.getItem((ARBITRARY_INT)));
/*These don't help!*/
//myFolder.update();
//myFolder.pack();
//myFolder.redraw();
The folder works just fine by itself. i.e. users may tab through with the mouse. The difference is that I would like to be able to show different tabs by default in different perspectives.
Any thoughts?
You need to use CTabFolder#setSelection(..). The show item only shows the item, like if there are a lot of items and some are hidden, this method will scroll to them.