I have a problem with Scrollview on Android. The problem is showing all content in a register form.
XML Layout
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#drawable/app_background"
tools:context=".RegisterActivity"
xmlns:tools="http://schemas.android.com/tools">
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="#string/register_header"
android:textSize="30sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="30dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_loginField"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="8dp"
/>
<EditText
android:id="#+id/register_input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:textColor="#000000"
android:hint="#string/hint_login"
android:layout_marginBottom="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_password"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="20dp"
/>
<EditText
android:id="#+id/register_input_passw"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="#000000"
android:hint="#string/hint_passw"
android:layout_marginBottom="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_repeatpass"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="20dp"
/>
<EditText
android:id="#+id/register_input_passwre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="#000000"
android:hint="#string/hint_passw"
android:layout_marginBottom="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_gender"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
android:layout_marginBottom="20dp"
/>
<RadioGroup
android:id="#+id/register_radiog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioButton
android:id="#+id/register_radioM"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_gMale"
android:textSize="16sp"
/>
<RadioButton
android:id="#+id/register_radioF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_gFemale"
android:textSize="16sp"
android:layout_marginBottom="20dp"
/>
</RadioGroup>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
/>
<EditText
android:id="#+id/register_input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="#000000"
android:hint="#string/hint_name"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_age"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp"
/>
<EditText
android:id="#+id/register_input_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="#000000"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal" >
<CheckBox
android:id="#+id/register_input_termsofuse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/register_termsofuse"
android:textSize="16sp"
android:textColor="#000000"
android:textStyle="bold"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/register_btSignup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#fc9a24"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="#string/register_btSignup"
android:textStyle="bold"
android:textSize="16sp"
android:textColor="#FFFFFF"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
But when I execute in my Android device I can't see the register_header textview.
Also when I click on one EditText, my device show keyboard, and all view is pushed up, hidding more items (email textview and edittext).
How can I solve this?
In this first image, as you can see header isn't showing. This is bad...
In this second image, I can scroll and see register button, this is good.
And in this third image, when keyboard appears and I go to top of the scrollview I can't see the register_header, the email input and email textview
How can I, fix layout position (not push up when keyboard appears) and show all content inside Scrollview.
Thx
Add this to your activity in your manifest
<activity android:windowSoftInputMode="adjustPan"> </activity>
The activity's main window is not resized to make room for the soft
keyboard. Rather, the contents of the window are automatically panned
so that the current focus is never obscured by the keyboard and users
can always see what they are typing. This is generally less desirable
than resizing, because the user may need to close the soft keyboard to
get at and interact with obscured parts of the window.
Related
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
Have googled a lot but couldnt find a satisfying solution. The below screenshot depicts the issue I am facing.
Edittext hides behind titlebar when soft keyboard is visible. I have put
android:gravity="center_vertical"
property in the main layout. If i remove this property then the layout works fine.But the design requirement needs the form to be in center.I have tried everything.Tried using scrollview and putting this into manifest
android:windowSoftInputMode="stateVisible|adjustResize"
Have also tried "adjustPan" and it does works.But in this case the entire form is not pushed up.the edittext 'MobileNo' and the button stays hidden behind soft keyboard.
Layout xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="324dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#39CCCCCC"
android:orientation="vertical"
android:isScrollContainer="true"
android:padding="5dp"
>
<EditText android:id="#+id/edit_name"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:hint="#string/register_name"
android:textColor="#color/black"
android:textSize="20sp"
android:background="#drawable/rounded_edittext_bg"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:padding="5dp"
android:inputType="textPersonName"/>
<EditText android:id="#+id/edit_email"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:hint="#string/register_emailid"
android:textColor="#color/black"
android:textSize="20sp"
android:background="#drawable/rounded_edittext_bg"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:padding="5dp"
android:inputType="textEmailAddress" />
<EditText android:id="#+id/edit_password"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:hint="#string/register_pass_hint"
android:textColor="#color/black"
android:textSize="20sp"
android:background="#drawable/rounded_edittext_bg"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:padding="5dp"
android:inputType="textPassword" />
<EditText android:id="#+id/edit_confpassword"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:hint="#string/register_confpass"
android:textColor="#color/black"
android:textSize="20sp"
android:background="#drawable/rounded_edittext_bg"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:padding="5dp"
android:inputType="textPassword" />
<EditText android:id="#+id/edit_mobile"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:hint="#string/register_mobile"
android:textColor="#color/black"
android:textSize="20sp"
android:background="#drawable/rounded_edittext_bg"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:padding="5dp"
android:maxLength="11"
android:inputType="phone"/>
<Button android:id="#+id/signup_btn"
android:layout_width="match_parent"
android:layout_height="#dimen/edittext_dimen"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_gravity="center_horizontal"
android:text="#string/register_signup"
android:textSize="20sp"
android:background="#3F799F"
android:textColor="#color/white"/>
</LinearLayout>
</LinearLayout>
Is there any solution for this? Any workaround that could help me achieve my goal? please reply with your views and suggestions.
If you are not able to understand my doubt.Please feel free to ask.
Thank you in advance.
I explain Your mistakes. You have given liner layout hight as 324dp .so when Keyboard open Linear Layout require that much space in screen so it goes up and not visible Your first edittext.
Use relative layout instead.
Wait for some moment I give you modified XML with change. till time check your xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="5dp" >
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#39CCCCCC"
android:isScrollContainer="true"
android:orientation="vertical"
android:padding="5dp" >
<EditText
android:id="#+id/edit_name"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="20dp"
android:hint="Name"
android:inputType="textPersonName"
android:padding="5dp"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="#+id/edit_email"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:hint="Email"
android:inputType="textEmailAddress"
android:padding="5dp"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="#+id/edit_password"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:hint="password"
android:inputType="textPassword"
android:padding="5dp"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="#+id/edit_confpassword"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:hint="Confirm password"
android:inputType="textPassword"
android:padding="5dp"
android:textColor="#000"
android:textSize="20sp" />
<EditText
android:id="#+id/edit_mobile"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:hint="register"
android:inputType="phone"
android:maxLength="11"
android:padding="5dp"
android:textColor="#000"
android:textSize="20sp" />
<Button
android:id="#+id/signup_btn"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#3F799F"
android:text="signup"
android:textColor="#fff"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
Activity Tag in manifest write this android:windowSoftInputMode="adjustResize|adjustPan"
I change your dimention, size, color also String resourch
add adjustPan in manifest under activity tag
android:windowSoftInputMode="adjustResize|adjustPan"
I'm learning about Layout managers to improve my app design. For the most part it worked out ok. The only thing I want is my buttons to be positioned a little higher.I can achieve this by removing the 3 buttons from the layout manager but by doing this I have issues on lower res devices. (The buttons will position themselves over the EditText fields or position themselves over my ad at the bottom). I've tried some things I found online but I only ended up ruining the layout.
Here is my XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/textviewLayoutLeft"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tvPpl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp"
android:text="Price Per Liter"
android:textStyle="bold" />
<TextView
android:id="#+id/tvAvgConsumption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:text="avg(l/100km)"
android:textStyle="bold" />
<TextView
android:id="#+id/tvDistance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="Distance (km)"
android:textStyle="bold" />
<TextView
android:id="#+id/tvAmountOfPersons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:text="# Persons"
android:textStyle="bold" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp"
android:text="Price Per Person"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/textfieldLayoutRight"
android:layout_width="166dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/textPrijsPerLiter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/textVerbruik"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/textAfstand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/textAantalPersonen"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ems="10"
android:imeOptions="actionGo"
android:inputType="numberDecimal" />
<TextView
android:id="#+id/textViewPPP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#ffff000f"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<Button
android:id="#+id/btnBereken"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Calculate"
android:textStyle="bold" />
<Button
android:id="#+id/btnReset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reset all textfields"
android:textStyle="bold" />
<Button
android:id="#+id/btnLoad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load latest results"
android:textStyle="bold" />
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="MY_ID" />
</LinearLayout>
</RelativeLayout>
You can:
Give up second linear layout and move button layout and ad layouts to main layout. Stick ad layout to bottom and declare it BEFORE button layout. Set buttons adjustments to layout_below="textfieldlayout" and layout_above="ad" instead of layout_alignParentBottom="true".
Consider using linear layout with weightSum. Every parent layout should have weightSum=100, every child will respectively have % of space. From my point of view this way would be the best, because views will position equally for merely all devices and even layout tree depth will remain the same. You'll only have to change the parent layout to LinearLayout and set weights.
I have an activity that allows me to enter content. It consists of edit text and button bar. Whenever I what to input something to the edit text, a keyboard pops up and the button bar is on top if it so I can't see what I'm typing if the content is long(it goes behind the button bar). How can i fix it ?
my code is:
<RelativeLayout
android:id="#+id/toplayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/notetop"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp" >
<TextView
android:id="#+id/title_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp" />
<EditText
android:id="#+id/etTitleJoke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/title_text1"
android:background="#android:color/transparent"
android:hint="#string/no_title"
android:imeOptions="actionNext"
android:singleLine="true"
android:textColor="#000000"
android:textSize="18sp" >
</EditText>
</RelativeLayout>
<view
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/etContentJoke"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toplayout"
class="ie.myjokes.LineEditText"
android:background="#android:color/transparent"
android:capitalize="sentences"
android:scrollHorizontally="true"
android:fadingEdge="vertical"
android:gravity="top"
android:padding="5dp"
android:scrollbars="vertical"
android:textColor="#000000"
android:textSize="22sp" >
<requestFocus />
</view>
<LinearLayout
android:id="#+id/footer"
style="#android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="#+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClickSave"
android:text="#string/btn_save"
android:textColor="#000000" />
<Button
android:id="#+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClickCancel"
android:text="#string/btn_cancel"
android:textColor="#000000" />
</LinearLayout>
nevermind, I added this line into my activity and its gone now. Thank you
android:windowSoftInputMode="adjustPan"
I am working in android. I am designing a login page.
This is my xml:-
<LinearLayout
android:layout_marginLeft="10dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_marginRight="10dip"
android:id="#+id/loginlayout"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:soundEffectsEnabled="false">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/rounded_corners_white"
android:padding="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Id"
android:textColor="#000000"
android:textSize="8pt" />
</TextView>
<EditText
android:layout_height="wrap_content"
android:id="#+id/EditText_UID"
android:layout_width="200dp"
android:background="#drawable/text_box">
</EditText>
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="Password"
android:textSize="8pt">
</TextView>
<EditText
android:text=""
android:id="#+id/EditText_Pass"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:background="#drawable/text_box">
</EditText>
<RelativeLayout
android:layout_height="35px"
android:layout_width="fill_parent"
android:layout_marginTop="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/Button_Submit"
android:textColor="#FFFFFF"
android:clickable="true"
android:layout_toRightOf="#id/Button_Register"
android:background="#drawable/button_register_right"
android:layout_alignParentTop="true"
android:textSize="5pt">
</Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
whenever i enter user name then it is visible to user, but when i enter password then the entered text is not visible till the android device keyboard is active. When i press back button to remove android device keyboard then it is visible means password dot visible to user.
but when i run this project on system then both userid and password both are visible. please suggest me what should i do for this. is this matter of device dependent ?
Use this attribute in your Password EditText :
android:inputType="textPassword"
Try this layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="10dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_marginRight="10dip"
android:id="#+id/loginlayout"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:soundEffectsEnabled="false">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/rounded_corners_white"
android:padding="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Id"
android:textColor="#000000"
android:textSize="8pt" />
<EditText
android:layout_height="wrap_content"
android:id="#+id/EditText_UID"
android:layout_width="200dp"
android:background="#drawable/text_box"/>
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="Password"
android:textSize="8pt"/>
<EditText
android:text=""
android:id="#+id/EditText_Pass"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:background="#drawable/text_box"
android:inputType="textPassword"/>
<RelativeLayout
android:layout_height="35px"
android:layout_width="fill_parent"
android:layout_marginTop="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/Button_Submit"
android:textColor="#FFFFFF"
android:clickable="true"
android:layout_toRightOf="#id/Button_Register"
android:background="#drawable/button_register_right"
android:layout_alignParentTop="true"
android:textSize="5pt">
</Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
you forget to set the input into the password field
Have you tried removing the weight attribute from your outermost LinearLayout, and have you tried wrapping the whole thing in a ScrollView?