Reputation: 303
This is kind of weird that in my page where I have 6 edit text fields, only the alternative edit texts are showing hint and rest of them are not. This happens only from Android 4.0 and onward. I don't find any reasons for this. Any suggestions would be helpful.
Here is the code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Removes title bar
setContentView(R.layout.register);
mLang = mPreference.getString("lang", "");
bBlood = (EditText) findViewById(R.id.editText8);
bDOB = (EditText) findViewById(R.id.editText5);
bAdd = (EditText) findViewById(R.id.editText6);
bPhone = (EditText) findViewById(R.id.editText7);
mProfile = (TextView) findViewById(R.id.textView1);
if(mLang.equalsIgnoreCase("English")){
}
else{
mProfile.setText(R.string.sign_up_arabic);
bName.setHint(R.string.name_arabic);
bDOB.setHint(R.string.name_arabic);
bAdd.setHint(R.string.address_arabic);
bPhone.setHint(R.string.name_arabic);
bBlood.setHint(R.string.blood_arabic);
mSignUp.setText(R.string.sign_arabic);
}
And this is the layout for the above code:
<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:background="#D5D2D2"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="@string/sign_up"
android:textSize="20sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/l1border"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@+id/textView1"
android:background="#000000" >
</LinearLayout>
<LinearLayout
android:id="@+id/lin1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/l1border"
android:layout_marginTop="10dp" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="@string/name" >
</EditText>
</LinearLayout>
<LinearLayout
android:id="@+id/lin5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lin1"
android:layout_marginTop="10dp" >
<EditText
android:id="@+id/editText5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/age"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:id="@+id/lin6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lin5"
android:layout_marginTop="10dp" >
<EditText
android:id="@+id/editText6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/address" />
</LinearLayout>
<LinearLayout
android:id="@+id/lin7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lin6"
android:layout_marginTop="10dp" >
<EditText
android:id="@+id/editText7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/phone"
android:inputType="numberDecimal" />
</LinearLayout>
<LinearLayout
android:id="@+id/lin8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/lin7"
android:layout_marginTop="10dp" >
<EditText
android:id="@+id/editText8"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/blood" />
</LinearLayout>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/lin8"
android:layout_below="@+id/lin8"
android:layout_marginTop="10dp"
android:text="@string/sign" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
The Screenshot looks something like this:
Upvotes: 1
Views: 1524
Reputation: 24848
I have seen that this two EditText which have not shown hint are inputType set as "number" and "numberDecimal"., so please check one time removing input type.,It's may be creating issue.
Upvotes: 2
Reputation: 2182
remove
android:layout_below="@+id/textView1"
from linear layout
Upvotes: 0