1

「最初」の画像は、正常に機能しているように見える XML レイアウトを使用して作成されたダイアログを示しています。

タブレットが「休止状態」に入った場合、タブレットが再びアクティブ化された後、画面イメージは「2 番目の」イメージのようになります。

休止状態に入る/休止状態から出るときにレイアウトが変わるのはなぜですか。

レイアウト ファイルは次のとおりです。

    <TableRow android:id="@+id/tableRow2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_marginBottom="3dp" >
        <TextView android:id="@+id/textView3" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" android:layout_marginRight="10dp" 
            android:text="Concept" 
            android:layout_weight="1"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:background="@drawable/rectanglewhite"
            android:textColor="#000000" 
            android:gravity="right"/>
        <TextView 
            android:id="@+id/tvsctconcept" android:layout_width="wrap_content" android:layout_height="wrap_content" 
            android:layout_weight="11" 
            android:text="" 
            android:textAppearance="?android:attr/textAppearanceMedium"/>            
    </TableRow>
    <TableRow android:id="@+id/tableRow3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_marginBottom="3dp" >
        <TextView android:id="@+id/textView3" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:layout_marginRight="10dp" 
            android:text="PT" 
            android:layout_weight="1" 
            android:textAppearance="?android:attr/textAppearanceMedium" 
            android:background="@drawable/rectanglepurple"
            android:textColor="#000000"
            android:gravity="right"/>
        <TextView 
            android:id="@+id/tvsctpt" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="" 
            android:layout_weight="11"
            android:textAppearance="?android:attr/textAppearanceMedium"/>            
    </TableRow>
    <TableRow android:id="@+id/tableRow4" 
        android:layout_height="wrap_content"
        android:layout_marginBottom="3dp" >
        <TextView android:id="@+id/textView3" 
            android:layout_width="50dp" 
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:text="FSN" 
            android:layout_weight="1" 
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:background="@drawable/rectanglebg2" 
            android:textColor="#000000"
            android:gravity="right" />
        <TextView 
            android:id="@+id/tvsctfsn" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:text="" 

            android:layout_weight="11"
            android:textAppearance="?android:attr/textAppearanceMedium"/>            
    </TableRow>
</TableLayout>

前 後

4

1 に答える 1

2

wrap_contentビュー幅で使用しています。xmlが最初にレンダリングされるとき、コンテンツに対して測定されていません。目覚めた後、それらには値があるtextviewので、それらはそのコンテンツにラップされます。幅を特定の値またはに設定する必要がありますmatch_parent

于 2012-10-11T17:53:10.813 に答える