android - Multiple lines in edittext changes the layout -


i developing first application in android. xml layout file has relativelayout , linearlayout both. root layout relative layout has textviews, buttons , edittext , 2 more relativelayouts in it. in 1st relativelayout have edittext below have button , switch. when enter data more 1 line in edittext button , switch below overlaps.

how can let edittext accept more 1 line without changing layout of widgets below ?

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id="@+id/relative1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/blue3"  >  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancemedium"     android:text="name"     android:id="@+id/textview5"     android:layout_marginleft="10dp"     android:layout_alignbottom="@+id/taskname"     android:layout_alignstart="@+id/textview7" />  <edittext     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/taskname"     android:hint="@string/hint_name"     android:layout_margintop="37dp"     android:layout_alignparenttop="true"     android:layout_alignparentend="true"     android:layout_toendof="@+id/textview7">     <requestfocus /> </edittext>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancemedium"     android:text="set location"     android:id="@+id/textview6"     android:layout_aligntop="@+id/button5"     android:layout_tostartof="@+id/taskname"     android:layout_margintop="20dp"     android:layout_marginleft="10dp"     android:layout_alignend="@+id/textview7" />  <imagebutton     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="set"     android:src="@drawable/pin1"     android:id="@+id/button5"     android:onclick="set_loc"     style="@style/btnstylebeige"     android:layout_margintop="46dp"     android:layout_below="@+id/taskname"     android:layout_alignend="@+id/relative3" />    <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textappearance="?android:attr/textappearancemedium"     android:text="always alert me"     android:id="@+id/textview7"     android:layout_centervertical="true"     android:layout_alignparentstart="true"     android:layout_marginleft="20dp"/>  <switch     android:layout_width="wrap_content"     android:layout_height="wrap_content"     style="@style/btnstylebeige"     android:id="@+id/switch1"     android:layout_marginright="10dp"     android:layout_centervertical="true"     android:layout_alignstart="@+id/button5" />  <relativelayout     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/relative2"     android:layout_margintop="40dp"     android:layout_below="@+id/switch1"     android:layout_alignparentstart="true"     android:layout_alignend="@+id/taskname">      <imagebutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/pickdate"         android:src="@drawable/c2"         style="@style/btnstylebeige"         android:layout_marginstart="53dp"         android:layout_alignparenttop="true"         android:layout_alignparentstart="true" />      <imagebutton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/picktime"         style="@style/btnstylebeige"         android:src="@drawable/c1"         android:layout_marginend="55dp"         android:layout_alignparenttop="true"         android:layout_alignparentend="true" />  </relativelayout>  <relativelayout     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/relative3"     android:layout_alignparentbottom="true"     android:layout_centerhorizontal="true"     android:layout_marginbottom="20dp">      <button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/button2"         android:text="add task"         android:onclick="add_task"         android:textcolor="@android:color/white"         style="@style/btnstylebeige"         android:background="@android:color/holo_blue_light"          />      <button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/button3"         android:text="cancel"         android:onclick="cancel"         android:textcolor="@android:color/white"         style="@style/btnstylebeige"         android:background="@android:color/holo_blue_light"         android:layout_alignparenttop="true"         android:layout_toendof="@+id/button2"         android:layout_marginstart="37dp" />     </relativelayout> 

what asking possible. so, need keep in mind using - relativelayout. relativelayout lays out each item in relation other elements on screen. so, if have elements layout dependent on edittext, position change if dimensions of edit text changed.

so being said, need go through layout , remove layout references edit text, , rebuild layout in mind.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -