0

Android 2.3.3

私は次の考えを念頭に置いてヘッダーを作成しようとしています

              Expression
 S.NO         Result    

  1.          1+2+3
              6

  2.          2+3-4
              1
  .....

データはデータベースからリストビューに入力されます。リストビューのヘッダー部分のXMLを作成しようとしています。(SNO、式、結果)。

これが私が使用しているXMLです...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:paddingTop="5dp" >


    <LinearLayout
        android:id="@+id/ll1"
        android:layout_width="0dip"
        android:layout_height="match_parent"
        android:layout_weight="0.10"
        android:orientation="horizontal" >

        <TextView
        android:id="@+id/txtView_History_Count"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="0.10"
        android:text="Number"
        android:textColor="#FFFFFF"
        android:textSize="22dp" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/ll2"
        android:layout_width="0dip"
        android:layout_height="match_parent"
        android:layout_weight="0.90"
        android:orientation="horizontal" > //If I change this to Vertical, 
                                           //the Output is not displayed

        <TextView
            android:id="@+id/txtView_History_Result"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:textSize = "22dp"
            android:text="Result"
            android:textColor="#316DA2" />

        <TextView
            android:id="@+id/txtView_History_Expression"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:text="Expression"
            android:textColor="#FFFFFF"
            android:textSize="15dp" />

    </LinearLayout>

</LinearLayout>

2番目の内側のレイアウトの向きを垂直に変更すると、テキストが表示されません。何が問題になっていますか?

また、最初のレイアウトを使用可能な合計スペースの10%(android:layout_weight = "0.10")にし、2番目のレイアウトを90%(android:layout_weight = "0.90")にします。次に、2番目のレイアウトのテキストビューは、2番目のレイアウトで使用可能なスペースの50%にまたがる必要があります。ネストされた重みなしでこれを作成する方法はありますか?

4

1 に答える 1

0

ついにそれを手に入れました..少しひねりと微調整をした後

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:paddingTop="5dp" >


        <TextView
        android:id="@+id/txtView_History_Count"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="0.20"
        android:text="Number"
        android:textColor="#FFFFFF"
        android:textSize="22dp" />



    <LinearLayout
        android:id="@+id/ll2"
        android:layout_width="0dip"
        android:layout_height="match_parent"
        android:layout_weight="0.80"
        android:orientation="vertical" >

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

            android:textSize = "22dp"
            android:text="Result"
            android:textColor="#316DA2" />

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

            android:text="Expression"
            android:textColor="#FFFFFF"
            android:textSize="15dp" />

    </LinearLayout>

</LinearLayout>
于 2013-03-16T11:13:32.093 に答える