Horizontal RadioGroup

by kaloer » Mon, 13 Apr 2009 12:14:20 GMT

Sponsored Links
I'm new to Android Developing, and don't know how to list the
RadioButtons in a RadioGroup horizontal instead of the default
vertical way.

Default it is like this:
(o) XX
(o) XX
(o) XX

How can i do this:
(o) X (o) X (o) X

I am doing the layout in code, so please answer using that instead of
xml :-)

Best Regards


Horizontal RadioGroup

by Ralf » Mon, 13 Apr 2009 13:49:55 GMT

 RadioGroup inherits from LinearLayout, so you should be able to simply
use android:orientation="horizontal" in your XML or the corresponding
java code (disclaimer: I've never tried to do so, but it seems



Sponsored Links

Horizontal RadioGroup

by kaloer » Mon, 13 Apr 2009 15:33:19 GMT

 Thank you,
I already had tried the getOrientation method, but did not know how to
use it. But i found out, that you simply write getOrientation(0) for
horizontal and getOrientation(1) for vertical :-)


Other Threads

1. ListActivity Memory leak with onConfigurationChanged


I'm using a ListActivity, with onConfigurationChanged. I'm doing this
because I don't want onCreate to be called so i don't have to reload
data in the list view every time I change orientation.

I've found that when I call setListAdapter in the onCreate method of
my ListActivity , after a Number of orientation changes I get an out
of memory error. If I don't set the ListAdapter I don't see the out of
memory error.

Just wondering if anyone else has seen this and knows of a way to
solve it?

Thanks, Example of the Code is Below:

public class MyActivity extends ListActivity   {
   private MyAdapter myAdapter;
   private ArrayList<String> data = new ArrayList<String>();

    public void onCreate(Bundle savedInstanceState) {
         this.myAdapter= new MyAdapter(this, R.layout.mylayout, data);
        setListAdapter(this.myAdapter);    //<--- If I remove this
line I do not see the memory leak on rotation of the screen

    public void onConfigurationChanged(Configuration newConfig) {
        setContentView(R.layout.main);      // <------ Needed to load
portrait/landscape layout


2. parsing an image from an xml file from a network

in my app  when i click a button it goes on to a url and it returns back an
xml file. The xml file recieved is opened in a new activity called B as a
list view. The xml file is as follows
              <Datebirth>Apr 15, 2011</Datebirth>
               <Datebirth>Apr 15, 2011</Datebirth>

i click on any of the first name i am moving on to a new activity C where i
want to display the last name,dob of the selected first name. In activity C
i have a button image. When i click on it i am moving to a new activity D
where i want to show the image of the selected first name.

How to do this, please help me.........

Siva Shankar K


3. apps-for-android.googlecode.com/svn

4. replace transparent color bitmap with alpha

5. USB cdc_acm was not recognized by host

6. Wifi manually turned off, freezes phone, requires battery removal

7. Ant Mayhem v0.8.0