How to create an UI in circular fashion in Android? - android

I need to create a dynamic UI for an android app. For example, I need to create clickable buttons on the circumference of a circle with a main button at the center. The user should be able to add/delete/modify the number of nodes/buttons on the circumference of the circle with settings option.
Till now I have worked on static UI using xml layout. This time I have to start working dynamic model. How can I proceed?
Uploaded sample UI how I would like to build. As shown in figure I should be able to create a dynamic UI, user should be able to click on the boxes, should be able to add few more boxes which should auto adjust its position with respect to other boxes. When I click on the box it should bring another activity with different UI with the selected box populated to center surrounded by related data in similar format shown in figure.

Related

To draw the graph like Structure along with the Radiobutton?

enter image description here
As I am beginner in android so I don't know the name of this structure exactly but i have highlighted it in rectangle shape...
I have to design this in xml is it possible to design it in xml??
If not how it can be done???
I have a screen like this a graph like structure along with 4 Radiobuttons.The data in the radio button wont be static it might change. I just want the radio buttons over the line of the graph and it might not vary if the screen size changes.
So all in all i want to implement this graph like structure with radio button does any one has any idea what this is called originally and how it will be implemented
Thanks in advance :-)

Is there a performence difference between creating a button programmatically or creating it in xml?

I want to create 16 buttons each have different texts on it.Those text will be picked up randomly from an array depending on another random value.Lets say,
I have 3 words (apple,banana,watermelon), when the activity created it will pick up one of these words.Lets say apple.And in this activity's screen there will be 16 buttons.These buttons must have the letters that apple consists of "a","p","p","l","e" and the remaining buttons will be filled up with other remaining letters of the alphabet.
So in my case what I wonder is should i do the button creation programmatically by taking a value and assigning this value on creation one by one or do it in the xml and leave their text parts and fill up programmatically.
These 2 options in detail :
First : I'm going to create a function which takes a String value as a paramater and returns a button with this text set on it by using setText(); and then locate it in the layout.
Second : I create the layout with those button and leave blank their text parts and in the activity I only assign their letter values.
I vote for the second option but I'd like to know what's your opinion and would there be a difference in terms of performance or memory ?
The disadvantage of declarative approach is that you can get only so
far with XML.
XML is great for look and feel of your user interface, but it does not provide a great way of handling user input. That's where the programmatic approach came.
Everything you can do declarative as well as with programmatically. But java also allows you to specify what happens when the button is actually clicked.
This is the main advantage of programmatic approach to the user interface.
So what is Best ?
Here it is , Both are good at thier point.
1) Use XML , when everything about your user interface is static , such as layout of the screen , all the widget etc.
2) Then switch to the programmatic approach when user interacts with various widget in the user interface.
In other words you would use XML for what the button Looks like and
Java to specify what it does.

android- make a listview grow upwards only

Im creating an in app chat and I cant figure out how to keep the listview I have implemented to keep from growing down below the edittext box I set up to take user chat. Whats happening now is that new lines add to the listview just fine but after the list grows large enough it starts to add to itself below the edittext box. I find that pretty annoying and imagine a user would too so my question is:
How can I keep a listview from growing downwards.
Id like for new fields/text to add to the bottom of the listview but be placed ontop of the edittext just like any normal chat would do.
It's very easy, simply set the transcriptMode. If you do it from XML, you have the choice between normal and alwaysScroll:
http://developer.android.com/reference/android/widget/AbsListView.html#attr_android:transcriptMode
This is how the built-in Google Talk and SMS/MMS applications are implemented (they use the normal transcript mode.)

showing text and image both while displaying list of applications in android

i want to create a home screen application where the applications looks like carousel , and i am able to do it . The problem i am facing is that in my application only the applications icon are getting displayed the text is missing in it , where as my requirement is that i want to both the icon and text to be displayed together.
my application displays same as the above showing image.
i want text to be combined with it as above image.
please help me.
Thanks
datta
So the simplest thing to do would be to create a Compound Control. This compound control would essentially be a LinearLayout with both and ImageView and a TextView in it. Then, where ever you use a CarouselImageView in your code, just use your new compound control instead.

popup windows in android?

Pretty new to android so excuse me if this is a really obvious question.
Say my application has a bunch of TextViews, each one showing the attributes of a certain product (name, price, etc). I have a button next to each of these TextViews labeled "modify".
How do I make it so that when I press the modify button next to a certain attribute, a popup window with a space to enter text into comes up so that the user can enter text into this box and then have the actual attribute listing on the original page change? Actually I just need a push in the right direction with creating this popup text field... not sure if there is already some built in functionality for this or if not, what would be the best way to create this kind of thing.
Thanks.
Why not have the modify button set TextEdit.setEnabled(true); and then change focus with TextEdit.setFocus? Note that both of these are inherited from view
If you really want a dialog you might want to looking into the AlertDialog.Builder. I know you can use it with buttons and radio buttons, but I'm not sure you can get it to work with a TextView.
Use a code like this for the input popup: Android dialog input text
In the positive button handler, set your edittext content programmatically like this:
myEditText.setText(value).
As simple as that. The only difference with a standard GUI framework is that you don't retrieve the value as a result of the popup function. Instead, you must provide an action handler.

Categories

Resources