Android application background colour
I have my main.xml up and in the XML code I have:
<?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:id="@+id/imageView1" android:layout_height="wrap_content" android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="116dp"></ImageView>
开发者_如何学编程 <TextView android:layout_height="wrap_content" android:text="Administration 0.0.1" android:textAppearance="?android:attr/textAppearanceSmall" android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_below="@+id/imageView1" android:layout_centerHorizontal="true"></TextView>
</RelativeLayout>
But when I run the app in an emulator, the default theme still shows with the black background. I can't figure out why it's doing this.
Any ideas?
What background color are you expecting? It shows up correctly for me if you're expecting white. This is what the screen looks like (I have substituted your image with the android icon)
Does your onCreate() look like this -
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
精彩评论