android - Layout pushes up when keyboard popups -
whole layout pushes when keyboard pops up. xml file contains listview , below 2 buttons, when keyboard popups both listview , buttons pushes up.
<?xml version="1.0" encoding="utf-8"?> <linearlayout 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" tools:context="com.example.athis.buy.homescreen"> <searchview android:layout_width="match_parent" android:layout_height="wrap_content" /> <listview android:id="@+id/list_item" android:layout_width="match_parent" android:layout_height="0dp" android:layout_margintop="10dp" android:layout_weight="8" android:divider="#ffffff" android:dividerheight="10dp" android:padding="5dp" /> <linearlayout android:id="@+id/buttons" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#a8b3ff" android:gravity="bottom" android:orientation="horizontal" android:weightsum="100"> <button android:id="@+id/filter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginend="5dp" android:layout_marginleft="10dp" android:layout_marginright="5dp" android:layout_marginstart="10dp" android:layout_weight="50" android:text="filter" android:layout_marginbottom="2dp"/> <button android:id="@+id/sort" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginend="10dp" android:layout_marginleft="5dp" android:layout_marginright="10dp" android:layout_marginstart="5dp" android:layout_weight="50" android:text="sort" android:layout_marginbottom="2dp"/> </linearlayout> </linearlayout>
i have added android:windowsoftinputmode="statehidden" in manifest when touch edittext keyboard should pop up
add windowsoftinputmode="adjustpan"
attribute in androidmanifest.xml
particular activity
. refer this.
<activity android:name=".activities.youractivity" android:label="@string/app_name" android:screenorientation="portrait" android:windowsoftinputmode="adjustpan" />
hope helps. gl!
Comments
Post a Comment