0

使用しているすべてのグリッドのカスタム グリッド ビューがあります。

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

<View
    android:layout_width="fill_parent"
    android:layout_height="30sp"
    android:layout_marginTop="85sp"
    android:background="@drawable/shelf" />

<ImageView
    android:id="@+id/imgThumb"
    android:layout_width="47.5sp"
    android:layout_height="76sp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="29sp"
    android:background="@drawable/pic1" />

<ImageView
    android:id="@+id/bookCover"
    android:layout_width="60sp"
    android:layout_height="80sp"
    android:layout_marginLeft="127sp"
    android:layout_marginTop="26sp"
    android:background="@drawable/book_cover" />

Eclipseのグラフィカルレイアウトの前にこのように見えます ここに画像の説明を入力

しかし、エミュレータでこれを実行しているときは次のようになります ここに画像の説明を入力

本の表紙の画像が消えてしまいました Android の初心者です 問題の場所と解決方法を教えてください

** FrameLayout も機能しません**

4

2 に答える 2

0

次のように変更してみてください。

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

<ImageView
    android:id="@+id/imgThumb"
    android:layout_width="47.5sp"
    android:layout_height="76sp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="29sp"
    android:background="@drawable/pic1" />

<ImageView
    android:id="@+id/bookCover"
    android:layout_below="@id/imgThumb"
    android:layout_width="60sp"
    android:layout_height="80sp"
    android:layout_marginLeft="127sp"
    android:layout_marginTop="26sp"
    android:background="@drawable/book_cover" />

したがって、あなたの背景が表示されます。また、方向は RelativeLayout には含まれません。

于 2013-03-30T10:07:26.810 に答える
0

以下のコードを使用してください

            <RelativeLayout
            android:id="@+id/dummy"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >

            <ImageView
                android:id="@+id/pitch"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@drawable/pic1"
                android:scaleType="fitXY" />

            <ImageView
                android:id="@+id/image1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="80sp"
                android:layout_marginTop="50sp"
                android:background="@drawable/book_cover" />
        </RelativeLayout>
于 2013-03-30T10:10:38.780 に答える