Как поместить customview и linearlayout в один и тот же XML-файл - PullRequest
0 голосов
/ 24 марта 2012

Моя проблема в том, что я использую одно пользовательское представление в своем XML-файле, этот же XML-файл также содержит другие компоненты, такие как текстовое представление, кнопки изображения,

этот пользовательский вид содержит изображения, которые я хочу на фоне

но это блокирует весь мой макет (другие компоненты)

и я могу видеть только пользовательский вид

следующий мой код

 <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>

Может кто-нибудь сказать, как использовать пользовательский вид на фоне и другие компоненты на переднем плане. означает, что компоненты должны отображаться в пользовательском представлении.

Спасибо заранее.

1 Ответ

0 голосов
/ 26 марта 2012

Пожалуйста, проверьте следующий код. Я добавил только два виджета пользовательского интерфейса: TextView и Button. Вы можете добавить больше в соответствии с вашими потребностями.

<?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>

...