开发者

Disappearing Views

开发者 https://www.devze.com 2023-03-13 10:59 出处:网络
I have a fairly standard layout for the first screen of the setup wizard on my app. I have been developing it with a solid color background which I defined in a theme. I have recently got a png file t

I have a fairly standard layout for the first screen of the setup wizard on my app. I have been developing it with a solid color background which I defined in a theme. I have recently got a png file that I would like to used as the background. This works fine on all screens apart from the 3 screens for the setup wizard. The problem being that only the first textview is drawn. I used the hierachy viewer and the other views where not listed.

These are the only screens that use an include statement so I suspect this may be the root of the problem but even if I take out the include statement I still have the problem.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

   <TextView
        android:id="@+id/welcome"
        android:text="@string/welcome"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:gravity="center_horizontal"
        android:textColor="#433A33"
        android:textStyle="bold">
    </TextView>
   <ImageView 
        android:id="@+id/mainIcon"
        android:src="@drawable/main_icon" 
        android:layout_width="100dip"  
        android:layout_height="100dip"
        android:layout_centerHorizontal="true"
        android:layout_below="@+id/welcome">
    </ImageView>
    <TextView
        android:id="@+id/description"
        and开发者_如何学Croid:text="@string/description"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:layout_below="@+id/mainIcon"
        android:gravity="center_horizontal"
        android:textColor="#433A33"
        android:textSize="15dip">
  </TextView>
    <TextView
        android:id="@+id/choice"
        android:layout_below="@id/description"
        android:text="@string/choice"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="10dip"
        android:gravity="center_horizontal"
        android:textColor="#433A33"
        android:textSize="15dip">
  </TextView>
     <Spinner 
        android:id="@+id/language" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@id/choice"
        android:prompt="@string/languagePrompt"
        android:textSize="10dip" 
        android:layout_marginRight="20dip" 
        android:layout_marginLeft="20dip">
    </Spinner>

  <include layout="@layout/wizard_bottom"  android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</RelativeLayout>

Let me know if anybody has any ideas.

Edited to show the problem with a screen shot

Disappearing Views


The problem was that the theme I was using was setting the background to all Views rather than just the window background. So the background that is in the screen shot is the background for that one imageView and all the other views where pushed off the page.

I changed the them accordingly and it working fine now

0

精彩评论

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

关注公众号