I have designed the login layout as follows
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/login_bg">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:id="#+id/login_fields_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">
<ImageView
android:id="#+id/loginLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="30dp"
android:src="#drawable/logo" />
<EditText
android:id="#+id/userNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/username"
android:drawablePadding="10dip"
android:hint="#string/hint_username"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLength="50"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/password"
android:drawablePadding="10dip"
android:hint="#string/hint_password"
android:imeOptions="actionNext"
android:inputType="textPassword"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<LinearLayout
android:id="#+id/loginOptionsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="2">
<CheckBox
android:id="#+id/rememberMeCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:checked="false"
android:drawableEnd="#drawable/bg_checkbox"
android:gravity="center_vertical"
android:paddingRight="40dp"
android:text="#string/text_rememberme"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
<Button
android:id="#+id/forgotPasswordButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#null"
android:gravity="right|center_vertical"
android:singleLine="true"
android:text="#string/text_forgotpassword"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#drawable/button_bg"
android:text="#string/text_login"
android:textColor="#android:color/white"
android:textSize="20dp"
android:textStyle="bold" />`
</LinearLayout>
</ScrollView>
</RelativeLayout>
when the i touched on the edittext the background is moving up it need to be constant as it is outside the scrollview.How to solve this issue.
i have referred the following
Background Image Placement
as in this they need in the bottom corner i need it as background.but anyway with curiosity i tried it but still it is scrolling the background
I tried it and it works. Remove the background from xml layout
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE|WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
getWindow().setBackgroundDrawableResource(R.drawable.login_bg) ;
Use the following in your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Related
This is what i want to build.
the circular portion will be outside of layout and the rest portion will be transparent as default action
Till now i have achieved.
the circular portion is getting out but the parent layout is not taking any transparency what i need. I have tried to give the transparent color but its not taking. what i need is the blue portion in the second image, i need it transparent just like when dialog appears. But it is taking the color from parent layout.
Any reference will be appreciated.TIA
Here is my layout xml :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:id="#+id/bottom_layout"
android:background="#color/colorRed"
>enter code here
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_25sdp"
android:background="#color/colorWhite"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:layout_marginTop="#dimen/_45sdp"
android:orientation="vertical">
<TextView
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_7sdp"
android:backgroundTint="#color/colorLightGrayText"
android:gravity="center"
android:hint="#string/settings"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorBlackText"
android:textColorHint="#color/colorBlackText"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_18sdp"
android:textStyle="bold"/>
<CustomTextView
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10sdp"
android:backgroundTint="#color/colorLightGrayText"
android:gravity="center"
android:hint="#string/login_to_access_settings"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorGray"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_15sdp" />
<android.support.design.widget.TextInputLayout
android:id="#+id/userName_Wrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:layout_marginTop="#dimen/_25sdp"
android:textColorHint="#color/colorLightGrayText"
android:theme="#style/TextLabelGray"
app:errorTextAppearance="#style/error_appearance_gray">
<CustomEditText
android:id="#+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/colorLightGrayText"
android:hint="Username"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorWhite"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_14sdp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/password_wrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:textColorHint="#color/colorLightGrayText"
android:theme="#style/TextLabelGray"
app:errorTextAppearance="#style/error_appearance_gray">
<CustomEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/colorLightGrayText"
android:hint="#string/password"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorWhite"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_14sdp" />
</android.support.design.widget.TextInputLayout>
<CustomTextView
android:id="#+id/logInSettingWrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:layout_marginBottom="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:background="#drawable/bg_gray_rounded_rect"
android:gravity="center"
android:padding="#dimen/_10sdp"
android:text="#string/login_to_settings"
android:textAllCaps="true"
android:textColor="#color/colorWhite"
android:textSize="#dimen/_16sdp"
android:textStyle="bold" />
<ImageView
android:id="#+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="#dimen/_15sdp"
android:layout_marginBottom="#dimen/_15sdp"
android:src="#drawable/cross_pg_bottom_gray" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:layout_marginBottom="-50dp"
android:background="#drawable/bg_bottom_sheet">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/nav_settings" />
</FrameLayout>
</FrameLayout>
</LinearLayout>
you just need to make transparent your blue color layout .I hope it helps you unless you update your xml file.
Im trying to make a UI with a few fields in the middle of the screen and a button at the bottom. When i am writing a number in the fields, the keyboard hides part of the interface (which i want it to), but i also need the whole interface to be scrollable so that i can adjust the screen and keep filling the fields with the keyboard on. I've put the whole setup in a relative layout and put it under a scroll view. The posts here say it should work that way but it isnt working for me.
The XML code is
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.maaz.rakattracker.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="#+id/farzET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center"
android:hint="0"
android:inputType="number"
android:singleLine="true"
android:textAlignment="center" />
<TextView
android:id="#+id/farzLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:elevation="0dp"
android:ems="5"
android:text="farz"
android:textAlignment="center"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="#+id/sunnatET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="0"
android:inputType="number"
android:singleLine="true"
android:textAlignment="center" />
<TextView
android:id="#+id/sunnatLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:text="Sunnat"
android:textAlignment="center"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="#+id/naflET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center"
android:hint="0"
android:inputType="number"
android:singleLine="true"
android:textAlignment="center" />
<TextView
android:id="#+id/naflLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:text="Nafl"
android:textAlignment="center"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:id="#+id/witrET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="0"
android:inputType="number"
android:singleLine="true"
android:textAlignment="center" />
<TextView
android:id="#+id/witrLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:text="Witr"
android:textAlignment="center"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Button" />
</RelativeLayout>
</ScrollView>
Kindly help me figure out the issue here.
Thanks
Try to add this code in your Activity inside onCreate() method :
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_ADJUST_PAN);
In your manifest, add android:windowSoftInputMode="adjustResize" to your Activity tag.
On your manifest file add
<activity
android:name=".YOURACTIVITY"
android:windowSoftInputMode="adjustPan" />
<activity
that because scroll view work only with LinearLayout
[This is the image i need to move up only edittext not the logo ][1]edittext appearing on the top of the keyboard after setting windowSoftInputMode but other views also moving up. is their any way to move only edittext .Thanks in advance
[1]: https://i.stack.imgur.com/NEpf3.png`
<ScrollView
android:id="#+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:src="#drawable/logo_light"
android:text="LOGO"
android:textColor="#color/black"
android:textSize="100dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/ll_send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="50dp"
android:orientation="horizontal">
<EditText
android:id="#+id/editMessage"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:background="#color/white"
android:gravity="center"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"
android:hint="EDIT TEXT"
android:minLines="3"
android:textColorHint="#color/black"
android:scrollHorizontally="false"
android:textColor="#color/white" />
<Button
android:id="#+id/buttonSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="#color/black"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
`
Try to use framlayout and xml like below
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="#+id/edit_text_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_vertical"
android:layout_marginLeft="12dp"
android:background="#null"
android:layout_alignParentBottom="true"
android:hint="Enter you something"
android:inputType="textCapSentences|textMultiLine"
android:maxLength="2000"
android:maxLines="8" />
</FrameLayout>
If your using relative layout , in the edit text tag add this.
android:layout_alignParentBottom="true"
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.
when keyboard appears i am able to resize the window using android:windowSoftInputMode="adjustResize" which allow me not to hide the submit button but it resize my image also which i don't want.
Only submit button should move up when keyboard is visible without resizing image.
I tried frame layout also but it didn't may be i tried wrong way. Any help will be appriciated.
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 .
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;
}
});
So I have surrounded RelativeLayout with ScrollView but when I run it in the Android emulator, it is still not scrolling. Did I accidentally messed up some code? Because it just stopped scrolling.
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<RelativeLayout
android:id="#+id/new_meal_form_relative"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/meal_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:text="#string/meal_label"
android:textSize="20sp"/>
<EditText
android:id="#+id/meal_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/meal_label"
android:hint="Event Title"
android:inputType="textCapSentences"
android:maxLines="1"/>
<EditText
android:id="#+id/meal_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/meal_name"
android:hint="Location(eg: CSC Room232)* "
android:inputType="textCapSentences"
android:maxLines="1"/>
<EditText
android:id="#+id/meal_event"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/meal_location"
android:gravity="top"
android:hint="Description of the event. What kind of food. Any additional info... \n"
android:inputType="textMultiLine|textCapSentences"/>
<TextView
android:id="#+id/textViewRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/meal_event"
android:text="Rating: "/>
<Spinner
android:id="#+id/rating_spinner"
android:layout_width="71dp"
android:layout_height="47dp"
android:layout_alignTop="#+id/textViewRequired"
android:layout_toRightOf="#+id/textViewRating"/>
<TextView
android:id="#+id/textViewRequired"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textViewRating"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:text="*Required"
android:textColor="#ffff4b48"
android:textSize="15sp"/>
<com.parse.ParseImageView
android:id="#+id/meal_preview_image"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_below="#+id/rating_spinner"
android:layout_centerHorizontal="true"/>
<ImageButton
android:id="#+id/photo_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/ic_action_photo"
android:layout_below="#+id/meal_preview_image"
/>
<Button
android:id="#+id/save_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/photo_button"
android:layout_toLeftOf="#+id/cancel_button"
android:background="#ffff001f"
android:text="#string/save_button_text"/>
<Button
android:id="#+id/cancel_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/photo_button"
android:text="#string/cancel_button_text"/>
</RelativeLayout>
</ScrollView>
The height of your relative layout should be android:layout_height="wrap_content"