In the following code, the 'user' and 'pass' text above the text boxes are not showing:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff">
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/login" android:id="@+id/imageView1" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></ImageView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="User:" android:layout_below="@+id/imageView1" android:layout_alignLeft="@+id/editText1" android:layout_marginTop="16dp"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/editText1" android:layout_below="@+id/textView1" android:layout_alignRight="@+id/imageView1" android:layout_alignLeft="@+id/imageView1"></EditText>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Pass:" android:layout_below="@+id/editText1" android:layout_alignLeft="@+id/editText2"></TextView>
<EditText android:inputType="textPassword" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/editText2" android:layout_below="@+id/textView2" android:layout_alignLeft="@+id/editText1" android:layout_alignRight="@+id/editText1"></EditText>
<Button android:text="Enter" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/editText2" android:layout_alignLeft="@+id/editText2" android:layout_marginTop="19dp" android:layout_alignRight="@+id/editText2"></Button>
</RelativeLayout>
Sorry it's a bit big and long but I have searched this question and tried to find solutions but can't apply th开发者_StackOverflow社区em to this very well. What am I doing wrong? Could someone guide me through how to solve this? Thanks
I think it may be that your background of the outer RelativeLayout is White (#ffffff), by default (correct me if I'm wrong) the text in Android is white, with a black background. Try messing around with themes. For a quick fix trying setting the android:textColor="#000000" on your TextViews or something similar.
精彩评论