2012-03-24 5 views
0

mein Problem ist, ich benutze eine benutzerdefinierte Ansicht in meiner XML-Datei, die gleiche XML-Datei enthält auch andere Komponenten wie Text-Ansicht, Bild-Schaltflächen,Wie man sowohl customview als auch linearlayout in dieselbe XML-Datei einfügt

dass benutzerdefinierte Ansicht der Bilder enthält, dass i

auf dem Hintergrund will, aber es ist mein ganzes Layout (andere Komponenten) blockiert

und ich kann mein Code nur benutzerdefinierte Ansicht

finden sie sehe

<FrameLayout 
android:id="@+id/framelayout" 
android:layout_height="fill_parent" 
android:layout_width="fill_parent"> 

<com.abc.android.image 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:id="@+id/imageview"> 
</com.abc.android.image> 

<LinearLayout 
android:id="@+id/linlayout1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/small1" 
android:orientation="vertical"> 

    All text view, ImageButtons 


</LinearLayout> 
</FrameLayout> 

kann jemand bitte erzählen, wie man custom-view im Hintergrund und anderen Komponenten auf einem Vordergrund verwendet. bedeutet, dass Komponenten über die benutzerdefinierte Ansicht angezeigt werden sollten.

Vielen Dank im Voraus.

Antwort

0

Bitte überprüfen Sie den folgenden Code. Ich habe nur zwei UI-Widgets hinzugefügt, d. H. Ein TextView und einen Button. Sie können mehr hinzufügen, je nachdem, was Sie brauchen.

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

<FrameLayout android:id="@+id/framelayout01" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:orientation="vertical"> 

    <ImageView android:layout_width="fill_parent" 
     android:layout_height="fill_parent" android:id="@+id/imageview01" 
     android:background="@drawable/pic"> 
    </ImageView> 

    <LinearLayout android:id="@+id/linearlayout02" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:orientation="vertical"> 

     <TextView android:text="Text View" android:layout_width="wrap_content" 
      android:layout_height="wrap_content" android:textSize="40dip" 
      android:textStyle="bold" android:layout_gravity="center" 
      android:layout_marginTop="50dip" android:textColor="#FF0000" /> 

     <Button android:text="Button" android:layout_width="fill_parent" 
      android:layout_height="80dip" android:gravity="center" 
      android:textSize="40dip" android:textStyle="bold" 
      android:layout_marginTop="50dip" /> 
    </LinearLayout> 

</FrameLayout>