Partial UI Screen Up
In a screen, I have a edit text on top (large contains space for 4-5 line), image view below that and submit button at bottom. on Keyboard up it should not hide my submit button. w
Solution 1:
Apply this and let me know is it still happening or not .
activity_mian.xml
<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:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/xxx.jpg"
android:orientation="vertical"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="20dp"
android:src="@drawable/logo_app" />
<EditText
android:id="@+id/edtEmail"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/login_textbox"
android:ems="10"
android:hint="Email"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textColor="#ffffff"
android:textCursorDrawable="@null" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/edtPassword"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/login_textbox"
android:ems="10"
android:hint="Password"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#ffffff"
android:textCursorDrawable="@null" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/edtPassword"
android:layout_marginTop="2dp" />
</RelativeLayout>
<CheckBox
android:id="@+id/checkBox_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:button="@drawable/checkbox_selector"
android:checked="true"
android:focusable="false"
android:focusableInTouchMode="true"
android:text=" Remember Me"
android:textColor="#ffffff" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<Button
android:id="@+id/btnLogin"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="top|center_vertical|center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_login" />
</LinearLayout>
</LinearLayout>
</ScrollView>
set your Button, EditText etc.. inside one linear layout followed by one parent ScrollView .
one another thing is that set android:windowSoftInputMode="stateAlwaysHidden" inside your java file where your xml file is bind .
Solution 2:
With some changes in @jigs answer i got it working and posting may be it can help others like me
1) Root layout as normal in my case Relative layout. Then scroll view inside scroll view take a Linear layout where specify edit text + image View. Then bottom button.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?android:attr/actionBarSize"
android:background="@android:color/white"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrollViewNotScrollable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/user_name_container">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical"
>
<EditText
android:id="@+id/input_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#00000000"
android:ellipsize="start"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="start|center_vertical"
android:hint="@string/feed_hint"
android:imeActionLabel="Submit"
android:imeOptions="actionSend"
android:inputType="textMultiLine|textAutoCorrect|textCapSentences"
android:maxLines="5"
android:minLines="3"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="25dp"
android:textColor="@color/feed_sub_color"
android:textColorHint="@color/light_gray"
android:textCursorDrawable="@null" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<!--<ScrollView
android:id="@+id/scroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isScrollContainer="false"
android:padding="4dp"
android:layout_centerHorizontal="true"
>-->
<ImageView
android:id="@+id/imgPreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:adjustViewBounds="true"
android:background="@android:color/white"
android:elevation="5dp"
android:padding="4dp"
android:visibility="gone" />
<!--</ScrollView>-->
<ImageView
android:id="@+id/close_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imgPreview"
android:layout_marginLeft="-45dp"
android:layout_marginTop="-20dp"
android:layout_toRightOf="@+id/imgPreview"
android:elevation="5dp"
android:paddingBottom="15dp"
android:src="@drawable/closeimage"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/user_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:fitsSystemWindows="true">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
<EditText
android:id="@+id/feed_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@null"
android:ellipsize="end"
android:fontFamily="san-serif-condensed"
android:padding="12dp"
android:singleLine="true"
android:text="sherry's phone"
android:textColor="@android:color/black"
android:textSize="@dimen/feed_name_size"
android:visibility="gone" />
<TextView
android:id="@+id/feed_user_name_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@null"
android:ellipsize="end"
android:fontFamily="san-serif-condensed"
android:padding="12dp"
android:paddingLeft="20dp"
android:singleLine="true"
android:text="sherry's phone"
android:textColor="@android:color/black"
android:textSize="@dimen/feed_name_size" />
<ImageView
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_gravity="end"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:scaleType="centerInside"
android:src="@drawable/editname" />
<Button
android:id="@+id/done"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_corner_update_block"
android:fontFamily="san-serif-medium"
android:text="Done"
android:textColor="@android:color/white"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
2)android:windowSoftInputMode="adjustResize" in your manifest.xml
3) disable scroll in java code (optional)
mScrollView.setOnTouchListener( new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event)
{
return true;
}
});
Post a Comment for "Partial UI Screen Up"