How to avoid overlap view in relative layout in android? -
<scrollview 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:orientation="vertical" > <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:textsize="30sp" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview1" android:textsize="20sp" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview2" android:textsize="20sp" /> <textview android:id="@+id/textview4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview3" android:textsize="20sp" /> <textview android:id="@+id/textview5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview4" android:textsize="20sp" /> <textview android:id="@+id/textview6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview5" android:textsize="20sp" /> <textview android:id="@+id/textview7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview6" android:textsize="20sp" /> <textview android:id="@+id/textview8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview7" android:textsize="20sp" /> <textview android:id="@+id/textview9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview8" android:textsize="20sp" /> <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview9" /> <textview android:id="@+id/textview10" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="εεΊεη:" android:textsize="15sp" android:layout_alignparenttop="true" android:layout_alignleft="@id/imageview1" /> <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_below="@id/textview10" android:contentdescription="@string/top" /> </relativelayout>
simple output: textview1 textview9 textview2 imageview1 . . . button1
the above layout page divide horizitonally, left side , there list of textview , button , right side, there image view. problem is: when textview content long, imageview overlap content of it, besides using bringtofront(), there way (in xml ) resize width of text view if overlap image view?
if using kind of design should use linear layout. , use table rows in display kind of view.
and use weight view doesn't et overlap on other views. try this:
<scrollview 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:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <tablerow android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:weightsum="10"> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:textsize="30sp" android:text="test" android:layout_weight="5" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/textview1" android:textsize="20sp" android:text="test" android:layout_weight="5"/> </tablerow> </linearlayout> </scrollview>
hope helps!!
Comments
Post a Comment