android - Dialog: Overflowing ScrollView Content -
newbie android developer here. have layout dialog:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/llparent" android:layout_width="match_parent" android:layout_height="wrap_content"> <scrollview android:id="@+id/svchild" android:layout_width="match_parent" android:layout_height="wrap_content"> ... content goes here </scrollview> <button android:id="@+id/btncancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@id/svchild" android:text="cancel"/> <button android:id="@+id/btnok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@id/svchild" android:layout_alignparentright="true" android:layout_alignparentend="true" android:text="ok" /> </relativelayout>
when scrollview
's content overflows screen, covers buttons below. buttons outside screen when changing properties of layout.
what want:
- show buttons on bottom of screen, not covered , not outside
llparent
,svchild
's heights setwrap_content
if content quite small, dialog doesn't have take of screen's height
thanks
use following code work properly
<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" tools:context="com.demo.example.activity.scrolldemo"> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/btnbutton" android:id="@+id/scrollview"> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> //place content here </linearlayout> </scrollview> <button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="button" android:id="@+id/btnbutton" android:layout_alignparentbottom="true" /> </relativelayout>
dependencies important here.
if have issue feel free comment.
Comments
Post a Comment