LinearLayout
にTextView
を追加しますが、と入力するとこのLinearLayout
が展開されます。私は本からのガイドに従っているので、それをRelativeLayout
またはそれに変更するオプションではありません。これは私のXMLコードです:TextViewを追加するときにLinearLayoutが展開されます
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="40"
android:background="@android:color/holo_orange_light">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:text=""
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/textView" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="60">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@mipmap/ic_launcher"
android:id="@+id/imageView"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
勿論親を持つので、 wrap_contentはその子の幅に調整されます(子の中で最大)。 –
ビューグループの通常の動作(Linearlayoutなど)は何ですか?しかし、あなたの質問は何ですか?あなたは別の行動をしたいですか? – Dibzmania