0

私は解決策を数時間探していました。BodyMassIndex 計算機を構築しようとしています。私はプログラムを終了しました (私は思う) が、アプリを実行しようとするたびに、エミュレーターでクラッシュします。その上、レイアウトのプレビューが表示されなくなりました。ログ内のすべてのエラー コードが何を意味するのかをまだ調べようとしています。私のlayout.xmlに問題があると思いますが、よくわかりません。提案やアイデアをいただければ幸いです。

ログキャット:

03-06 06:04:56.533: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:56.533: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:56.533: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:56.853: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:56.853: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.623: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.623: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.633: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.673: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.673: W/Trace(969): Unexpected value from nativeGetEnabledTags: 0
03-06 06:04:57.683: D/AndroidRuntime(969): Shutting down VM
03-06 06:04:57.683: W/dalvikvm(969): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
03-06 06:04:57.703: E/AndroidRuntime(969): FATAL EXCEPTION: main
03-06 06:04:57.703: E/AndroidRuntime(969): java.lang.NullPointerException
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.forceUniformHeight(LinearLayout.java:1348)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1336)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.TableRow.onMeasure(TableRow.java:114)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.View.measure(View.java:15513)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.TableLayout.measureChildBeforeLayout(TableLayout.java:464)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.TableLayout.measureVertical(TableLayout.java:476)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.TableLayout.onMeasure(TableLayout.java:439)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.View.measure(View.java:15513)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.View.measure(View.java:15513)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.View.measure(View.java:15513)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-06 06:04:57.703: E/AndroidRuntime(969):  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.View.measure(View.java:15513)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.Choreographer.doFrame(Choreographer.java:532)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.os.Handler.handleCallback(Handler.java:725)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.os.Handler.dispatchMessage(Handler.java:92)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.os.Looper.loop(Looper.java:137)
03-06 06:04:57.703: E/AndroidRuntime(969):  at android.app.ActivityThread.main(ActivityThread.java:5039)
03-06 06:04:57.703: E/AndroidRuntime(969):  at java.lang.reflect.Method.invokeNative(Native Method)
03-06 06:04:57.703: E/AndroidRuntime(969):  at java.lang.reflect.Method.invoke(Method.java:511)
03-06 06:04:57.703: E/AndroidRuntime(969):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-06 06:04:57.703: E/AndroidRuntime(969):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-06 06:04:57.703: E/AndroidRuntime(969):  at dalvik.system.NativeStart.main(Native Method)
03-06 06:04:57.833: D/dalvikvm(969): GC_CONCURRENT freed 155K, 10% free 2670K/2944K, paused 16ms+3ms, total 139ms

Java コード:

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class BMICalc extends Activity {

    // Constants Used when saving/restoring state.
    private static final String FEET_OF_HEIGHT = "FEET_OF_HEIGHT";
    private static final String INCH_OF_HEIGHT = "INCH_OF_HEIGHT";
    private static final String WEIGHT_IN_LBS = "WEIGHT_IN_LBS";

    private int currentFeetPortionOfHeight;         // Feet portion of height.
    private int currentInchesPortionOfHeight;       // Inches portion of height.
    private double currentWeight;                   // Weight of user in pounds.
    private EditText feetPortionOfHeightEditText;   // Displays feet portion of height.
    private EditText inchesPortionOfHeightEditText; // Displays inches portion of height.
    private EditText weightEditText;                // Displays weight of user.
    private Button calculateButton;                 // Button that starts calculation.
    private TextView bmiResultTextView;             // Displays BMI value.
    private TextView bmiResultCommentsTextView;     // Displays comment on user's BMI result.

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bmicalc);

        if (savedInstanceState == null) {   // If the application just started...
            currentFeetPortionOfHeight = 0;     // Initialize the feet portion to 0.
            currentInchesPortionOfHeight = 0;   // Initialize the inches portion to 0.
            currentWeight = 0.0;                // Initialize the weight to 0.
            // calculateBMI();                  // Calculation for BMI value.

        }
        else {  // Else (the application is being recovered from memory)...
            currentFeetPortionOfHeight = savedInstanceState.getInt(FEET_OF_HEIGHT);     // Initialize the feet portion to saved value.
            currentInchesPortionOfHeight = savedInstanceState.getInt(INCH_OF_HEIGHT);   // Initialize the inches portion to saved value.
            currentWeight = savedInstanceState.getDouble(WEIGHT_IN_LBS);                // Initialize the weight to saved value.
            // calculateBMI();                                                          // Calculation for BMI value.
        }

        // Get references to feet/inches/weight EditTexts.
        feetPortionOfHeightEditText = (EditText) findViewById(R.id.feetPortionOfHeightEditText);
        inchesPortionOfHeightEditText = (EditText) findViewById(R.id.inchesPortionOfHeightEditText);
        weightEditText = (EditText) findViewById(R.id.weightEditText);

        // Get references to TextViews displaying BMI & comment.
        bmiResultTextView = (TextView) findViewById(R.id.bmiResultTextView);
        bmiResultCommentsTextView = (TextView) findViewById(R.id.bmiResultCommentsTextView);

        // Get reference to calculateButton.
        calculateButton = (Button) findViewById(R.id.calculateButton);

        // EditText Watchers handle the EditTexts onTextChanged events.
        feetPortionOfHeightEditText.addTextChangedListener(feetPortionOfHeightEditTextWatcher);
        inchesPortionOfHeightEditText.addTextChangedListener(inchesPortionOfHeightEditTextWatcher);
        weightEditText.addTextChangedListener(weightEditTextWatcher);
        calculateButton.setOnClickListener(calculateButtonWatcher);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_bmicalc, menu);
        return true;
    }

    protected void onSavedInstanceState (Bundle outState) {

        // Saves the values of feetPortion.., inchesPortion.., & weightEditText.
        super.onSaveInstanceState(outState);
        outState.putDouble(FEET_OF_HEIGHT, currentFeetPortionOfHeight);
        outState.putDouble(INCH_OF_HEIGHT, currentInchesPortionOfHeight);
        outState.putDouble(WEIGHT_IN_LBS, currentWeight);
    }

    private void calculateBMI() {

        // Calculates the bmiResult.
        double bmiResult = currentWeight * 703 / 
                Math.pow((currentFeetPortionOfHeight * 12 + currentInchesPortionOfHeight), 2);

        // Sets the bmiResultComment statement based on bmiResult value.
        String bmiResultComment = setBMIResultComment(bmiResult);

        // Sets bmiResultTextView & bmiResultCommentTextView.
        bmiResultTextView.setText(String.format("%.02f", bmiResult));
        bmiResultCommentsTextView.setText(bmiResultComment);
    }

    private String setBMIResultComment (double bmiResult) {
        String bmiResultComment = "";   // Creates & initializes the bmiResult comment statement.

        // Sets the bmiResultComment to appropriate statement.
        if ( bmiResult == 0.0) {

            bmiResultComment = ""; // If BMI is zero, nothing has been entered & nothing needs to be displayed.

        } else if (bmiResult < 18.5) {

            bmiResultComment = "BMI Values under 18.5 are considered to be UNDERWEIGHT!";

        } else if (bmiResult < 24.9) {

            bmiResultComment = "BMI Values between 18.5 and 24.9 are considered to be NORMAL.";

        } else if (bmiResult < 29.9) {

            bmiResultComment = "BMI Values between 24.9 and 29.9 are considered to be OVERWEIGHT!";

        } else {

            bmiResultComment = "BMI Values over 30 are considered to be OBESE!!!";

        }

        return bmiResultComment; // Returns the bmiResultComment string value.
    }

    private OnClickListener calculateButtonWatcher = new View.OnClickListener() {

        @Override
        public void onClick(View calculateButtonListener) {
            calculateBMI(); // Calculation for BMI value.
        }

    };

    private TextWatcher feetPortionOfHeightEditTextWatcher = new TextWatcher() {

        @Override
        public void onTextChanged (CharSequence s, int start, int before, int count) {

            try {currentFeetPortionOfHeight = (int) Double.parseDouble( s.toString() );} // Convert currentFeetPortion... to double.
            catch (NumberFormatException e) {currentFeetPortionOfHeight = 0;}            // Default if an exception occurs.
        }
        @Override
        public void beforeTextChanged (CharSequence s, int start, int before, int count) { /* Intentionally left empty. */ }
        @Override
        public void afterTextChanged (Editable s) { /* Intentionally left empty. */ }
    };

    private TextWatcher inchesPortionOfHeightEditTextWatcher = new TextWatcher() {

        @Override
        public void onTextChanged (CharSequence s, int start, int before, int count) {

            try {currentInchesPortionOfHeight = (int) Double.parseDouble( s.toString() );} // Convert currentInchesPortion... to double.
            catch (NumberFormatException e) {currentInchesPortionOfHeight = 0;}          // Default if an exception occurs.
        }
        @Override
        public void beforeTextChanged (CharSequence s, int start, int before, int count) { /* Intentionally left empty. */ }
        @Override
        public void afterTextChanged (Editable s) { /* Intentionally left empty. */ }
    };

    private TextWatcher weightEditTextWatcher = new TextWatcher() {

        @Override
        public void onTextChanged (CharSequence s, int start, int before, int count) {

            try {currentWeight = (int) Double.parseDouble( s.toString() );} // Convert currentWeight to double.
            catch (NumberFormatException e) {currentWeight = 0;}            // Default if an exception occurs.
        }
        @Override
        public void beforeTextChanged (CharSequence s, int start, int before, int count) { /* Intentionally left empty. */ }
        @Override
        public void afterTextChanged (Editable s) { /* Intentionally left empty. */ }
    };  

}

レイアウト XML :

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/TableLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="left"
        tools:context=".BMICalc" >

        <TableRow
            android:id="@+id/tableRow0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/introductionTextView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_column="0"
                android:layout_span="2"
                android:layout_weight="1"
                android:background="@color/DodgerBlue"
                android:gravity="center"
                android:padding="@dimen/introductionTextViewPadding"
                android:text="@string/introductionTextView"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textColor="@color/White" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/heightPromptTextView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_column="0"
                android:layout_span="2"
                android:layout_weight="1"
                android:padding="5sp"
                android:background="@color/LightGrey"
                android:text="@string/heightPromptTextView" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp" >

            <EditText
                android:id="@+id/feetPortionOfHeightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="number" />

            <TextView
                android:id="@+id/feetPortionOfHeightViewText"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="0"
                android:gravity="center_vertical"
                android:padding="5sp"
                android:paddingRight="5sp"
                android:text="@string/feetPortionOfHeightTextView" />

            <EditText
                android:id="@+id/inchesPortionOfHeightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="number" />

            <TextView
                android:id="@+id/inchesPortionOfHeightViewText"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="0"
                android:gravity="center_vertical"
                android:padding="5sp"
                android:paddingRight="5sp"
                android:text="@string/inchPortionOfHeightTextView" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/weightPromptTextView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_column="0"
                android:layout_span="2"
                android:layout_weight="1"
                android:padding="5sp"
                android:background="@color/LightGrey"
                android:text="@string/weightPromptTextView" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp"
            android:paddingLeft="20sp" >

            <EditText
                android:id="@+id/weightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:layout_column="1"
                android:inputType="number" >

                <requestFocus />
            </EditText>

            <TextView
                android:id="@+id/weightTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:gravity="center|left"
                android:padding="5sp"
                android:text="@string/weightTextView" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp" >

            <Button
                android:id="@+id/calculateButton"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:textColor="@color/White"
                android:textStyle="bold"
                android:background="@color/Navy"
                android:text="@string/calculateButton" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp" >

            <TextView
                android:id="@+id/bmiResultTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="@string/bmiResultsTextView"
                android:textAppearance="?android:attr/textAppearanceLarge" />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/bmiResultCommentsTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="@string/bmiResultCommentsTextView" />

        </TableRow>

    </TableLayout>
4

2 に答える 2

1

以下の TableLayout について覚えておいてください。

子を水平に配置するレイアウト。TableRow は、常に TableLayout の子として使用する必要があります。TableRow の親が TableLayout でない場合、TableRow は水平 LinearLayout として動作します。

TableRow の子は、XML ファイルで layout_width および layout_height 属性を指定する必要はありません。TableRow は常に、これらの値をそれぞれ MATCH_PARENT と WRAP_CONTENT に強制します。

私はあなたのレイアウトを使用し、いくつかの属性を削除しました.それは今働いています. 削除した属性を 1 つずつ追加し、グラフィック レイアウト タブを使用して有効性を確認してください。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/TableLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="left"
        tools:context=".MainActivity" >

        <TableRow
            android:id="@+id/tableRow0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/introductionTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/heightPromptTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            >

            <EditText
                android:id="@+id/feetPortionOfHeightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                />

            <TextView
                android:id="@+id/feetPortionOfHeightViewText"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"

                />

            <EditText
                android:id="@+id/inchesPortionOfHeightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="number" />

            <TextView
                android:id="@+id/inchesPortionOfHeightViewText"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_weight="0"
                android:gravity="center_vertical"
                android:padding="5sp"
                android:paddingRight="5sp"
                />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/weightPromptTextView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"

                 />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp"
            android:paddingLeft="20sp" >

            <EditText
                android:id="@+id/weightEditText"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                android:inputType="number" >


            </EditText>

            <TextView
                android:id="@+id/weightTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                 />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp" >

            <Button
                android:id="@+id/calculateButton"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5sp" >

            <TextView
                android:id="@+id/bmiResultTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                />

        </TableRow>

        <TableRow
            android:id="@+id/tableRow7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/bmiResultCommentsTextView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                 />

        </TableRow>

    </TableLayout>
于 2013-03-06T08:31:48.787 に答える
0

レイアウトファイルに問題があります。テーブル行のエラーと子の高さをスパンします。このxmlを使用してみてください。テーブルrow0から同じものをコピーして貼り付けるだけで、うまくいくはずです。

    <TableRow
        android:id="@+id/tableRow0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/introductionTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_column="0"

            android:layout_weight="1"
            android:background="#00ff00"
            android:gravity="center"
            android:padding="10dp"
            android:text="introductionTextView"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#ffffff" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/heightPromptTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_column="0"

            android:layout_weight="1"
            android:padding="5sp"
            android:background="#aaaaaa"
            android:text="heightPromptTextView" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5sp" >

        <EditText
            android:id="@+id/feetPortionOfHeightEditText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:inputType="number" />

        <TextView
            android:id="@+id/feetPortionOfHeightViewText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:gravity="center_vertical"
            android:padding="5sp"
            android:paddingRight="5sp"
            android:text="feetPortionOfHeightTextView" />

        <EditText
            android:id="@+id/inchesPortionOfHeightEditText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:ems="10"
            android:inputType="number" />

        <TextView
            android:id="@+id/inchesPortionOfHeightViewText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:gravity="center_vertical"
            android:padding="5sp"
            android:paddingRight="5sp"
            android:text="inchPortionOfHeightTextView" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/weightPromptTextView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_column="0"

            android:layout_weight="1"
            android:padding="5sp"
            android:background="#aaaaaa"
            android:text="weightPromptTextView" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5sp"
        android:paddingLeft="20sp" >

        <EditText
            android:id="@+id/weightEditText"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_column="1"
            android:inputType="number" >

            <requestFocus />
        </EditText>

        <TextView
            android:id="@+id/weightTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center|left"
            android:padding="5sp"
            android:text="weightTextView" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5sp" >

        <Button
            android:id="@+id/calculateButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:textColor="#ffffff"
            android:textStyle="bold"
            android:background="#00ff00"
            android:text="calculateButton" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="5sp" >

        <TextView
            android:id="@+id/bmiResultTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="bmiResultsTextView"
            android:textAppearance="?android:attr/textAppearanceLarge" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/bmiResultCommentsTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center"
            android:text="bmiResultCommentsTextView" />

    </TableRow>

</TableLayout>
于 2013-03-06T08:06:55.977 に答える