android - ScrollView is only showing single view inside its sub-hierarchy -
i supposed add scrollview
, enable user scroll down after button. however, not showing supposed show.
whatever add after button
, doesn't show on device/emulator. supposed add imageview
under button
, seem not displaying after button
.
following xml:
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:weightsum="1"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="description:" android:id="@+id/textview14" android:paddingtop="20dp" android:layout_below="@+id/edittext" android:layout_alignleft="@+id/edittext" android:layout_alignstart="@+id/edittext" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="restaurant location:" android:id="@+id/textview15" android:paddingtop="20dp" android:layout_below="@+id/edittext2" android:layout_alignleft="@+id/edittext2" android:layout_alignstart="@+id/edittext2" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new button" android:id="@+id/button2" android:layout_below="@+id/imageview3" android:layout_centerhorizontal="true" /> </relativelayout> </scrollview>
the problem not aligning views correctly. example, there's no edittext2
, edittext
, imageview3
, you're aligning views around left or below of them.
either replace relativelayout
linearlayout
or use xml (i've replaced unknown ids correct ones):
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/textview14" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="description:" android:paddingtop="20dp" /> <textview android:id="@+id/textview15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="restaurant location:" android:paddingtop="20dp" android:layout_below="@+id/textview14" /> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new button" android:layout_below="@id/textview15" android:layout_centerhorizontal="true" /> </relativelayout> </scrollview>
Comments
Post a Comment