handle listview and edittext in same view



I use list view and edit text in same view. I want list view work like autocomplete.It work fine but if i click in edit text and keyboard opened then my view going to compress. How can i handle this without specific height and width, I mean i need compatibly with all devices. If anyone can help I'd appreciate it, thanks!


i use this code for doing this in xml,



<RelativeLayout
android:id="@+id/rlRoothome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5" >

<TextView
android:layout_width="match_parent"
android:layout_height="20dip"
android:layout_marginLeft="15dip"
android:layout_marginTop="3dip"
android:gravity="left|center"
android:text="Destination"
android:textSize="11sp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dip"
android:padding="2dip" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3" >

<LinearLayout
android:id="@+id/llhome_drop_icon"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".35"
android:gravity="center"
android:orientation="vertical"
android:padding="6dip" >

<ImageView
android:id="@+id/ivdestinationview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />
</LinearLayout>

<LinearLayout
android:id="@+id/llselect_Destination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.3"
android:orientation="vertical" >

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:orientation="horizontal"
android:padding="2dip"
android:visibility="visible" >

<TextView
android:id="@+id/tvhome_destination"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:hint="Destination"
android:imeOptions="actionDone"
android:paddingLeft="5dp"
android:paddingRight="30dp"
android:singleLine="true"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/llgotomap12"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_weight=".35"
android:gravity="center"
android:padding="2dip" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="20dip"
android:layout_marginLeft="15dip"
android:gravity="left|center"
android:text="Taxi Lines"
android:textSize="11sp" />

<LinearLayout
android:id="@+id/lltaxilineclick"
android:layout_width="match_parent"
android:layout_height="45dip"
android:padding="2dip" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3" >

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".35"
android:gravity="center"
android:orientation="vertical"
android:padding="6dip" >

<ImageView
android:id="@+id/ivtaxilineview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" />

<ImageView
android:id="@+id/ivtaxilineview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.3"
android:orientation="vertical" >

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:orientation="horizontal"
android:padding="2dip"
android:visibility="visible" >

<TextView
android:id="@+id/tvhome_taxiline"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:hint="Pick Taxi lines"
android:paddingLeft="5dp"
android:paddingRight="30dp"
android:singleLine="true"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/lladdnewtaxi_line"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_weight=".35"
android:gravity="center"
android:padding="2dip" >

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="3.5"
android:orientation="vertical"
android:weightSum="2" >

<TextView
android:id="@+id/tvdistrict_taxiline"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".2"
android:gravity="center"
android:text="Select District"
android:textSize="16sp" />

<ListView
android:id="@+id/lvdistricts"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1.8"
android:background="@null"
android:choiceMode="singleChoice"
android:visibility="visible" />
</LinearLayout>

<LinearLayout
android:id="@+id/llsetdestination"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:padding="5dip" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/poibg" >

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="FIND A TACO RIDER"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/llnearbymsg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".5" >

<TextView
android:id="@+id/tvnearbymsg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="loading"
android:textColor="#ff0000"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

<ListView
android:id="@+id/lvFindlocation_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dip"
android:background="@null"
android:choiceMode="singleChoice" />

</RelativeLayout>

No comments:

Post a Comment