开发者

Android application background colour

开发者 https://www.devze.com 2023-03-26 01:06 出处:网络
I have my main.xml up and in the XML code I have: <?xml version=\"1.0\" encoding=\"utf-8\"?> <RelativeLayout

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)

Android application background colour

Does your onCreate() look like this -

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号