I have an android application that has 3 EditText widgets. When I enter values, everything is fine. When I click a button, the cursor and/or text like falls below the line as shown in the images. I can click and drag the text/cursor up and down (like it was a date chooser or something). This does happen on all 3 fields. This happens on a device, and in an emulator.
I do not recall changing any properties on those widgets that could cause this, and such, examining all the properties does not shed any light on what would cause it. Even if there are not any values, such as the the discount field, I can move the hint text just like I can move the user entered values. I thought perhaps it had something to do what I was doing with onClickListenener, but I do not change anything there. I can choose a selection from the overflow menu and it happens there too. Any ideas on why this is happening?
The XML for the field:
<?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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_calc">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:id="#+id/tableLayout">
<TableRow
android:layout_width="fill_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="100dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/etxtPrice"
android:layout_column="1"
android:textAlignment="center"
android:hint="Price"/>
<EditText
android:layout_width="100dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/etxtDiscount"
android:layout_column="2"
android:textAlignment="center"
android:hint="Discount" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="%"
android:id="#+id/textView"
android:layout_column="3"
android:textSize="20dp" />
<EditText
android:layout_width="100dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/etxtTax"
android:layout_column="4"
android:textAlignment="center"
android:hint="Tax" />
</TableRow>
Since the height of the edittext is wrap_content.. the edit text can accommodate any number of lines of text. Use android:singleLine="true" attribute to force it to single line.
Related
This is how my xml layout file in IDE looks like:
It looks like that on every device BUT Marshmallow ones, which ended up looking like this:
As you can see, the password EditText and Remember CheckBox disappeared without a trace, yet I still can declare them in the class file normally.
This is my xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_log_in"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="my.app.LogInActivity">
<!-- Dummy item to prevent AutoCompleteTextView from receiving focus -->
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_width="0px"
android:layout_height="0px"
android:id="#+id/linearLayout5"
android:orientation="horizontal" />
<!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component
to prevent the dummy from receiving focus again -->
<AutoCompleteTextView android:id="#+id/autotext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:nextFocusUp="#id/autotext"
android:visibility="invisible"
android:nextFocusLeft="#id/autotext"
android:textSize="15sp" />
<TextView
android:id="#+id/txtname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/txt_customer"
android:layout_alignBottom="#+id/txt_customer"
android:text="Name"
android:textSize="14sp" />
<EditText
android:id="#+id/txt_customer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autotext"
android:layout_toEndOf="#+id/bt_exit"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPersonName"
android:maxLength="100"
android:textSize="15sp" />
<EditText
android:id="#+id/txt_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_alignParentEnd="true"
android:layout_alignStart="#+id/txt_customer"
android:ems="10"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:maxLength="100"
android:textSize="15sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txtname"
android:layout_alignStart="#+id/txtname"
android:layout_below="#+id/txt_customer"
android:layout_marginTop="25dp"
android:text="Pasword"
android:textSize="14sp" />
<Button
android:id="#+id/bt_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:text="LogIn"
android:textColor="#000000" />
<Button
android:id="#+id/bt_exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toEndOf="#+id/linearLayout5"
android:text="Quit"
android:textColor="#000000" />
<CheckBox
android:id="#+id/check_remember"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/txt_password"
android:layout_below="#+id/txt_password"
android:text="Remember" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout5"
android:layout_toEndOf="#+id/linearLayout5"
android:text="Log In" />
The Name EditText and Password EditText are the same yet only the Password one disappears on Marshmallow 6.0 devices. I have already tried to change theme, Build Target, position but it's still the same. What had go wrong?
EDIT #1:This question mentioned "messy code" and it was solved by "cleaning up" the code. I am using RelativeLayout as parent like him, but changing to LinearLayout isn't viable.
EDIT #2: I tried to preset a value just to login, and it worked normally like I just typed it in manually. Inside layouts file are the same: Only one EditText appears, the rest (EditText, CheckBox, RadioButtons) disappear. What is going on?? Example:
On Marshmallow:
Solved the disappearing bug. From this SO answer which leads me to this Google issue. I have to delete android:layout_alignBaseline attribute and they will render fine.
In an Activity of my Application, the user has to submit many Strings trough an EditText and a Button. As the range of the submits can go from a minimum of 9 to a maximum of 24, I want this process to be as easy and fast as possible.
I was thinking about making the Keyboard always visible while the whole Activity content gets pushed up.
I have tried to use the following rule in the Manifest to make it push the Activity android:windowSoftInputMode="adjustResize" but it looks like it only pushes up the content with a marginBottom.
Any ideas bout how to achieve this?
EDIT:
The following is the XML code of the Layout of my Activity:
<?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 xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.FET.leonardo.scurcola.NameSelection"
android:background="#e0ab18">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/whoMaster"
android:textColor="#color/white"
android:textSize="50sp"
android:layout_marginTop="50dp"
android:textAlignment="center"
android:id="#+id/whoMaster"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="#string/master"
android:ems="10"
android:textColorHint="#color/white"
android:textColor="#color/white"
android:textColorHighlight="#color/white"
android:id="#+id/names"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/next"
android:layout_marginBottom="50dp"
android:onClick="addPlayer"
android:text="#string/next"
android:layout_alignParentBottom="true"
android:layout_alignEnd="#+id/names"
android:textColor="#e0ab18" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/back"
android:id="#+id/back"
android:enabled="false"
android:onClick="removePlayer"
android:textColor="#e0ab18"
android:layout_marginBottom="50dp"
android:layout_alignParentBottom="true"
android:layout_alignStart="#+id/names" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/finish"
android:visibility="gone"
android:text="#string/finish"
android:layout_alignParentBottom="true"
android:layout_alignEnd="#+id/names"
android:layout_marginBottom="50dp"
android:onClick="toNextActivity"
android:textColor="#e0ab18"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/zero"
android:textSize="50sp"
android:textColor="#color/white"
android:id="#+id/playersLeft"
android:layout_below="#+id/names"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp" />
</RelativeLayout>
</ScrollView>
Apart from setting that option android:windowSoftInputMode="adjustResize", you can try using a ScrollView
Having so many fields can have some downside to your application speed - since every single element has to be drawn and that can be expensive. This will in turn affect your UI thread and could eventually cause app crashing.
Using a ScrollView, you can be able to scroll up and down through your EditText elements.
To speed up your application loading, for example if you have a lot more EditTexts, you can load half the elements/widgets when activity is loaded and once the user has started typing into the first field, load the rest.
This is an approach I have used several times and should work just fine!
Good luck and please let me know if this helps!
UPDATE
To have a scrollable view, make your root layout a ScrollView - remember it can only have 1 child.
<ScrollView
....
....
..... >
<RelativeLayout
....
....
..... >
<EditText />
...
</RelativeLayout>
</ScrollView>
So, basically you have a ScrollView as the root! That will enable you to scroll up the view and have the keyboard below or at the bottom!
I am programming an Android app which has an initial screen that works fine. The problem is that, when typing, a button overlaps the text, as you can see here:
Here is the code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.app.InitialActivity"
tools:showIn="#layout/activity_initial">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Welcome to app"
android:layout_marginTop="50dp"
android:id="#+id/textViewTitle"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<EditText
android:id="#+id/editTextEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textViewTitle"
android:layout_marginLeft="15dp"
android:layout_marginTop="50dp"
android:layout_marginRight="15dp"
android:inputType="textEmailAddress"
android:textSize="17sp"
android:hint="Enter your email"
android:ems="10" />
<EditText
android:id="#+id/editTextPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editTextEmail"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:layout_marginRight="15dp"
android:inputType="textPassword"
android:textSize="17sp"
android:hint="Enter your password"
android:ems="10" />
<Button
android:id="#+id/loginButton"
android:text="Login"
android:layout_centerVertical="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editTextPassword"
android:layout_marginLeft="15dp"
android:layout_marginTop="25dp"
android:layout_marginRight="15dp" />
<Button
android:id="#+id/registerButton"
android:text="Register"
android:layout_centerVertical="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/loginButton"
android:layout_marginLeft="15dp"
android:layout_marginTop="20dp"
android:layout_marginRight="15dp" />
<Button
android:id="#+id/forgotPasswordButton"
android:text="Forgot Password?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp" />
</RelativeLayout>
</ScrollView>
Any help will be much appreciated, thanks in advance.
When I was starting with Android development I was used to work with RelativeLayout too (I'm not an expert, I'm just telling my experience). At first, it looks like the most appropriate layout, but one thing that you should keep in mind is: let the system take care of the things to you, in other words, RelativeLayout is totally dependent from what you're saying, so with you don't think about new screen resolution, or an old one, the whole layout could become a mess.
The goal is, tell the Android what you want without using specific parameters (or at least try to avoid those). I agree with #klaymen: for different orientations you should use more than just one layout.
Just for an example, see the code below (it's a remake of your code):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.app.InitialActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Welcome to app"
android:id="#+id/textViewTitle" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/editTextEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:textSize="17sp"
android:hint="Enter your email"
android:ems="10" />
<EditText
android:id="#+id/editTextPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textSize="17sp"
android:hint="Enter your password"
android:ems="10" />
<Button
android:id="#+id/loginButton"
android:text="Login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/editTextPassword" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:weightSum="2"
android:orientation="horizontal">
<Button
android:id="#+id/registerButton"
android:text="Register"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="#+id/forgotPasswordButton"
android:text="Forgot Password?"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
There's a little things here that are importants and could help you a lot in the next tries (look for these properties in the code above):
android:layout_gravity;
Standard gravity constant that a child supplies to its parent. Defines how the child view should be positioned, on both the X and Y axes, within its enclosing layout.
android:gravity;
Specifies how an object should position its content, on both the X and Y axes, within its own bounds.
android:weightSum;
Defines the maximum weight sum. If unspecified, the sum is computed by adding the layout_weight of all of the children. This can be used for instance to give a single child 50% of the total available space by giving it a layout_weight of 0.5 and setting the weightSum to 1.0.
Must be a floating point value, such as "1.2".
This may also be a reference to a resource (in the form "#[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol weightSum.
android:layout_weight;
LinearLayout also supports assigning a weight to individual children with the android:layout_weight attribute. This attribute assigns an "importance" value to a view in terms of how much space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value, and then any remaining space in the view group is assigned to children in the proportion of their declared weight. Default weight is zero.
I hope that helps you. One more thing use your IDE in favor, generate some examples and look how they work (they used to be dynamic), I'm pretty sure that you will learn a lot with this exercise.
Good Luck!
One way to overcome this problem would be to use android:windowSoftInputMode="adjustNothing" inside your activity tag.
<activity name="YourActivity"
android:windowSoftInputMode="adjustNothing">
...
</activity>
However, keep in mind that in this case the register button will be covered by the keyboard.
You have set each view relative to another in the page.
You'd better place all of your elements in the page relative to one element or relative to main layout.
This problem is because of using "Relative Layout".
Another option is using an simpler layout like linear layout inside the relative layout to simplify things.
I'm trying to get the editTexts, and sign in button to move up when the software keyboard is out however I want the background to not be compressed(I'm going to add an image soon). I have the TextView(Login), two EditTexts(email and password) and signin button in a ScrollView because I thought that might help however I have not be able to figure anything out.
http://i.imgur.com/vlYifc6.png
http://i.imgur.com/vlYifc6.png
This is the xml
<RelativeLayout 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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".MainActivity">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/scrollView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:id="#+id/textLayout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Login"
android:id="#+id/loginView"
android:textSize="22dp"
android:layout_above="#+id/textLayout"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/emailTextfield"
android:inputType="textEmailAddress"
android:background="#android:drawable/edit_text"
android:textColor="#android:color/primary_text_light"
android:text="andresc1305#yahoo.com"
android:hint="Email" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="Password"
android:text="Andres123"
android:background="#android:drawable/edit_text"
android:textColor="#android:color/primary_text_light"
android:ems="10"
android:id="#+id/passwordTextfield" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIGN IN"
android:background="#android:color/transparent"
android:textSize="24dp"
android:id="#+id/signinButton"
android:layout_below="#+id/textLayout"
android:layout_centerHorizontal="true"
android:onClick="onSigninClick"/>
</LinearLayout>
</ScrollView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot your password?"
android:background="#android:color/transparent"
android:textSize="14dp"
android:id="#+id/forgotButton"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:onClick="onPasswordRecoverClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Register"
android:background="#android:color/transparent"
android:textSize="14dp"
android:id="#+id/registerButton"
android:layout_alignTop="#+id/forgotButton"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="onRegisterClick"/>
</RelativeLayout>
Look at this answer. In short, your problem can most likely be solved by setting the following in your AndroidManifest.xml inside the relevant activity or application element:
android:windowSoftInputMode="adjustResize"
#PPartisan
This is without:
android:windowSoftInputMode="adjustResize"
http://i.imgur.com/tbNioU2.png
This is with:
http://i.imgur.com/7ZePHjS.png
Beside the compression you can see my "Forgot your password" and "Register" buttons but I have those outside my ScrollView in the XML. Is there a way to scroll the LinearLayout (which contains the Login(TextView, email(EditText), password(EditText), and Signin(button) up when the software keyboard comes up?
The answer by zmilojko seems like what I want to do but he only says to add the ScrollView and not what to do after that has been added. Is there something I can place in the to make it move up when the software keyboard comes up?
see this thread, i think it can help you
layout of the screen moves up when keyboard is displayed
or just try to put this in your xml:
android:windowSoftInputMode="adjustPan"
or this
android:windowSoftInputMode="adjustNothing"
Seems like it works different in each case.
actually humm...let me try to explain...
I was following the tutorial for android app starters and
with this code the EditText part the there will be a default message which was set in the string but the default message is grey and when we use the phone and click on the EditText part the grey message will be gone....I tried doing this again but what I get is that the default message is black and when I click on the EditText on the phone the message will stay instead of gone which means I have to delete the message manually to enter what is wanted. Anyone can give me a hand with it?
<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="horizontal" >
<EditText android:id="#+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="#string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_send"
android:onClick="sendMessage" />
</LinearLayout>
The above is something I want and the below is what I have,
<RelativeLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
/*have a few more EditText, Buttons and TextView here but don't think it's relevant so didn't paste*/
<EditText
android:id="#+id/edit_percentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText1"
android:layout_alignParentBottom="true"
android:ems="10"
android:inputType="numberDecimal"
android:text="#string/edit_percentage" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/edit_percentage"
android:layout_alignRight="#+id/editText1"
android:text="#string/button3" />
</RelativeLayout>
I did thought if it's because of the relativelayout and linearlayout but didn't seem to be the problem.
It sounds like you want hint. Add this line
android:hint="#string/edit_percentage"
instead of
android:text="#string/edit_percentage"
Use android:text attribute.
<EditText android:id="#+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/edit_message" />