Using the ScrollView in Android -
i had long text in screen scrolling option. however, when enter scrollview, error shown
"" not set required layout_height attribute: (1) set "wrap_content" (2) set "match_parent" "" not set required layout_width attribute: (1) set "wrap_content" (2) set "match_parent" "" not set required layout_height attribute: (1) set "wrap_content" (2) set "match_parent" must supply layout_height attribute.
here .xml file
<scrollview xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.projextxy.cityinfo" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:text=" text goes in here " android:textappearance="?android:attr/textappearancemedium" /> </scrollview> </relativelayout> <scrollview android:layout_width="match_parent" android:layout_width="match_parent" > </scrollview>
i'm guessing used layout editor drag , drop scrollview in ends looking weird because posted mis-formatted xml file.
to simplify it, remove the attributes , should become apparent problem is:
<scrollview <-- start scrollview > <textview <-- start , end textview /> </scrollview> <-- end scrollview </relativelayout> <-- end relativelayout <scrollview <-- start scrollview > </scrollview> <-- end scrollview as see out of whack. change this:
<scrollview xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.projextxy.cityinfo" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:text=" text goes in here " android:textappearance="?android:attr/textappearancemedium" /> </scrollview> the rest not needed
Comments
Post a Comment