question about TableLayout

by chandlersong » Sat, 08 Aug 2009 12:43:51 GMT


Sponsored Links
 <RadioGroup
        android:id="@+id/
Radiogroup"
        
android:layout_width="fill_parent"
        
android:layout_height="wrap_content"
        
android:orientation="vertical"
<TableLayout
        android:id="@+id/
widget28"
        
android:layout_width="fill_parent"
        
android:layout_height="fill_parent"
        
android:orientation="vertical"
        xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        
<TableRow>
        
<RadioButton
                        android:id="@+id/
radioNumber"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
number"
        
android:layout_marginRight="1dip"
                        /
        
<RadioButton
                        android:id="@+id/
radioCharter"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
character"
        
android:layout_marginRight="1dip"
                        /
  </
TableRow>
 
<TableRow>
        
<RadioButton
                        android:id="@+id/
radioMix"
        
android:layout_width="wrap_content"
        
android:layout_height="wrap_content"
                        android:text="@string/
mix"
                        /
                </
TableRow>
        </
TableLayout>
</
RadioGroup>

    it's my xml config file.when  I add the tableLayout into the
raidogroup. I find that I can select more than one radiobutton at one
time.
    Does anyone konw how to fixed it?
--~--~---------~--~----~------------~-------~--~----~



question about TableLayout

by Mark Murphy » Sat, 08 Aug 2009 19:16:44 GMT


 


RadioButton widgets must be immediate children of RadioGroup for the
grouping effect to work. You cannot have intermediate containers, such
as your TableLayout and TableRows.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android Training in Germany, 18-22 January 2010:  http://bignerdranch.com 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


question about TableLayout

by 瀹嬪簡娆 » Sun, 09 Aug 2009 12:36:47 GMT


 Then How can I change the default screen formate.
   I hope that I can put the two  radiobutton at the first line the one at
the second line

2009/8/8 Mark Murphy <mmur...@commonsware.com>



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Accelerometer data

Hello,
I've been doing some testing on the accelerometer, specifically with
the old SensorListener and new SensorEventListener versions available
as of Cupcake.

Using SensorListener, I've been getting normal acceleration values as
expected according to the documentation - around 9.8 on the axis in
line with gravity when sitting still. When I upgraded the code to
SensorEventListener, that number jumped to around 30, which is not
consistent with the documentation. I've tried sampling at different
rates, but generally I've been using game mode, since that's the rate
I ultimately intend to use.

I'd be interested to hear if anyone has seen this behavior, has any
ideas about it, or sees an issue with the code below. Give it a test
run yourself. It might be relevant to note that the
SensorEvent.accuracy is SENSOR_STATUS_ACCURACY_HIGH.

When I run this code with the phone sitting flat on a table, screen,
up, I get values like these:

x: 12.5625      y: 20.8125      z: -16.4375


////////////////////////////////////////////////////////////////////


package edu.accel;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;

public class AccelTest extends Activity {

        private SensorManager mSensorManager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

                // Set up the accelerometer reading
      mSensorManager = (SensorManager)getSystemService
(Context.SENSOR_SERVICE);
      // Get the list of all sensors, and find the accelerometer
within
      List<Sensor> sensorList = mSensorManager.getSensorList
(SensorManager.SENSOR_ACCELEROMETER);

      mSensorManager.registerListener(mSensorListener,
                  sensorList.get(0),
                  SensorManager.SENSOR_DELAY_UI);

    }

        //Accelerometer
  private final SensorEventListener mSensorListener = new
SensorEventListener() {

        private PrintWriter mCurrentFile;

        boolean never = true;
        String comma = new String(",");

        public void runOnce()
        {
                //Creating a file to print the data into

        String nameStr = new String("/sdcard/10 second trials.xls");
                File outputFile = new File(nameStr);
                mCurrentFile = null;
                try {
                        mCurrentFile = new PrintWriter(new 
FileOutputStream(outputFile));
                } catch (FileNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }

        }

                @Override
                public void onAccuracyChanged(Sensor sensor, int accuracy) {
                        // TODO Auto-generated method stub

                }


                @Override
                public void onSensorChanged(SensorEvent event) {

                        if (never)
                {
                        never = false;
                        runOnce();
                }
                        StringBuffer buff = new StringBuffer();
                        buff.append(String.valueOf(event.values[0]));
                        buff.append(comma);
                        buff.append(String.valueOf(event.values[1]));
                        buff.append(comma);
                        buff.append(String.valueOf(event.values[2]));
                        mCurrentFile.println(buff.toString());
                }
  };
}


--~--~---------~--~----~------------~-------~--~----~

2. Socket Failing - Very basic question

Manifest file contains

<application android:icon=*"@drawable/icon"* android:label=*
"@string/app_name"*>

<uses-permission android:name=*"android.permission.INTERNET"* />

<activity android:name=*".WelcomeScreen"
*

android:label=*"@string/app_name"*>

<uses-permission android:name=*"android.permission.INTERNET"* />

Siddharth







--~--~---------~--~----~------------~-------~--~----~

3. using the music picker

4. Waiting for data connection

5. delay in AudioRecord?

6. Unable to open connection to supplicant on "wlan0": No such file or directory

7. Strange TabHost NullPointerException