リニアレイアウトで2段目の水平リニアレイアウトで下記xmlでTextView2とTextView3を調度1:1の比率で表示したいのですがうまくいみません。
andoridstudio上のデザインの見た目では意図する通りとなるのですが、実機で確認するとTextView3の描画開始位置がTextView2の終りの直後となってしまい左詰したような文字列になってしまいます。
期待する動きはTextView2は画面左から描画、TextView3は画面中央から描画が意図する動きです。
xml
1<?xml version="1.0" encoding="utf-8"?> 2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:descendantFocusability="blocksDescendants" 5 android:layout_width="match_parent" 6 android:layout_height="wrap_content"> 7 8 <LinearLayout 9 android:layout_width="match_parent" 10 android:layout_height="wrap_content" 11 android:orientation="vertical"> 12 13 <TextView 14 android:id="@+id/TextView1" 15 android:layout_width="match_parent" 16 android:layout_height="wrap_content" 17 android:paddingBottom="4dp" 18 android:text="date" 19 android:textColor="#000000" 20 android:textSize="16sp" /> 21 22 <LinearLayout 23 android:layout_width="match_parent" 24 android:layout_height="wrap_content" 25 android:orientation="horizontal"> 26 27 <TextView 28 android:id="@+id/TextView2" 29 android:layout_width="match_parent" 30 android:layout_height="wrap_content" 31 android:layout_weight="1" 32 android:text="num" 33 android:textColor="#0000ff" 34 android:textSize="16sp" /> 35 36 <TextView 37 android:id="@+id/TextView3" 38 android:layout_width="match_parent" 39 android:layout_height="wrap_content" 40 android:layout_weight="1" 41 android:text="weight" 42 android:textColor="#0000ff" 43 android:textSize="16sp" /> 44 45 </LinearLayout> 46 47 </LinearLayout> 48 49</LinearLayout>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/22 00:09