の下ScrollView
にあるボタンがあります。ボタンは親の下部に揃えられるように設定されています。スクロールビューはwrap_content
、その高さに対してに設定されます。ScrollView
コンテンツが入力されると、ボタンの下に表示されます。ボタンが開始したときに終了するように、ボタンの後ろに移動しないように設定するにはどうすればよいScrollView
ですか?
下のボタンに入れてみましandroid:layout_below
たが、うまくいかないときは上のボタンに入れてみlayout_above
ましたScrollView
。最後の1つで、起動時にアプリがクラッシュしました。理由はわかりません。最初ScrollView
のボタンが画面より長くなると、ボタンが下に配置され、アクセスできなくなります。
これが私のXMLファイルです。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_blue"
android:padding="5dp"
tools:context=".MainActivity" >
<EditText
android:id="@+id/editText_query"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/queryPromt"
android:imeOptions="actionNext"
android:inputType="text"
android:textColor="#000" />
<EditText
android:id="@+id/editText_tag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/editText_query"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@+id/saveButton"
android:hint="@string/tagPrompt"
android:imeOptions="actionDone"
android:inputType="text" />
<Button
android:id="@id/saveButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/editText_query"
android:text="@string/save" />
<TextView
android:id="@+id/textView_taggedSearches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignRight="@id/saveButton"
android:layout_below="@id/saveButton"
android:layout_marginTop="10dp"
android:background="#666"
android:gravity="center_horizontal"
android:text="@string/taggedSearches"
android:textColor="#FFF"
android:textSize="18sp" />
<ScrollView
android:id="@+id/scrollView_query"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/textView_taggedSearches"
android:padding="5dp" >
<TableLayout
android:id="@+id/tableLayout_query"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:stretchColumns="*" >
</TableLayout>
</ScrollView>
<Button
android:id="@+id/button_clearTags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/clearTags" />
</RelativeLayout>