Androidでアプリ開発に挑戦しているのですが、
レイアウトでエラーが出てしまいました。
Process 'command 'C:\Users\Panasonic\AppData\Local\Android\Sdk\build-tools\26.0.0\aapt.exe'' finished with non-zero exit value 1
原因を調べたところ、XMLが間違っているという検索結果が出てきたので、
修正点を元に戻したところ、エラーがでなくなりました。
どこを戻したかというと、レイアウトのxmlの部分なのですが、
xml
1<LinearLayout 2 android:id="@+id/detailViewGroup" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical" 6 android:padding="10dp"> 7 8 <TableLayout 9 android:layout_width="match_parent" 10 android:layout_height="match_parent" 11 android:stretchColumns="1" > 12 13 <TableRow> 14 15 <TextView 16 android:layout_width="match_parent" 17 android:layout_height="50dp" 18 android:gravity="left|center_vertical" 19 android:text="@string/***" 20 android:textAppearance="@style/textAppearanceDynamicSmall"/> 21 <Button 22 android:id="@+id/fromTime" 23 android:layout_width="match_parent" 24 android:layout_height="wrap_content" 25 android:gravity="right|center_vertical" 26 android:textAppearance="@style/textAppearanceDynamicSmall" /> 27 </TableRow> 28 29<!-- ここで tableLayoutの中に LinearLayoutをつっこんだ --> 30 <LinearLayout 31 android:layout_width="match_parent" 32 android:layout_height="match_parent" 33 android:orientation="horizontal"> 34 <TextView 35 android:layout_width="wrap_content" 36 android:layout_height="match_parent" 37 android:layout_weight="4" 38 android:gravity="left|center_vertical" 39 android:text="@string/***" 40 android:textAppearance="@style/textAppearanceDynamicSmall"/> 41 <Button 42 android:id="@+id/toDate" 43 android:layout_width="40dp" 44 android:layout_height="wrap_content" 45 android:layout_weight="2" 46 android:gravity="right|center_vertical" 47 android:textAppearance="@style/textAppearanceDynamicSmall" 48<!-- ばかやろう!!!!ここ ↓ みすってるじゃねーか!!!! --> 49 android:marginEnd="20dp"/> 50 <TextView 51 android:layout_width="wrap_content" 52 android:layout_height="match_parent" 53 android:layout_weight="4" 54 android:layout_marginLeft="20dp" 55 android:gravity="left|center_vertical" 56 android:text="@string/***" 57 android:textAppearance="@style/textAppearanceDynamicSmall"/> 58 <Button 59 android:id="@+id/toTime" 60 android:layout_width="40dp" 61 android:layout_height="wrap_content" 62 android:layout_weight="2" 63 android:gravity="right|center_vertical" 64 android:textAppearance="@style/textAppearanceDynamicSmall" /> 65 </LinearLayout> 66 </TableLayout> 67 </LinearLayout>
上記コードでなぜLinearLayoutを突っ込んでみたかというと、
1行だけ テーブルのカラムと関係なく横並びでテキストとボタンを配置したかった ためです。
TableRow だと知識不足でカラムがどうしても邪魔で...
ここで質問なのですが、TableLayoutの中に、LinearLayoutを配置することは不可能なのでしょうか。
または、 TableRowの中で設定しているカラムを無視してテキストやボタンを横並びに複数配置する ことは可能でしょうか。
お時間あるかたいらっしゃいましたらご助力いただけますと幸いです。
質問後の気づき
あれ・・・?列を結合したらよいだけなのでは・・・?
あれ・・・というかどっか記述ミスってるだけかもしれない・・・・
解決しました!!!!!!!
TableRowとLinearLayoutは組み合わせ可能でした。
正確にはコードに追記しましたが、margin が誤字ってただけです。あほんだら。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/12 06:18