0

私はアプリ ウィジェットを作成しています。レイアウトはViewウィジェットの下部に を配置し、 と を保持し、TextViewそのImageViewViewに を配置してメイン テキストを保持します。私が持っている問題は、「上部」Viewが下部と重なっているように見えることですView:

ここに画像の説明を入力

アップデート

今、私は「トップ」ビューがボトムビューと重なっていないと考えていますが、何かが画像の上部を切り取っています。別のスクリーンショットを次に示します。

ここに画像の説明を入力

ご覧のとおり、テキストは下部ビューの上部で切り取られていますが、画像も切り取られています。以下は、画像が 18 dp にスケーリングされていないスクリーンショットです。

ここに画像の説明を入力

私は非常に混乱しています。

これは私が使用しているコードです:

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/widgetLayout"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:padding="@dimen/widget_margin">

    <RelativeLayout
        android:id="@+id/widgetBgLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:paddingTop="10dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:background="@drawable/bg_widget"
         >

        <RelativeLayout
            android:id="@+id/widgetStatusLayout" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_alignParentBottom="true"
            android:paddingTop="10dp"
          >
                <TextView 
                    android:id="@+id/widgetStatus" 
                    style="@style/WidgetStatus"
                    android:layout_centerVertical="true"
                    android:layout_alignParentLeft="true" 
                />

                <ImageView 
                   android:id="@+id/widgetIcon"
                   android:src="@drawable/icon"
                   android:layout_width="18dp"
                   android:layout_height="18dp"
                   android:layout_alignParentRight="true"
                   android:layout_centerVertical="true"
                   android:scaleType="centerInside"
                   android:adjustViewBounds="true"
                 />

            </RelativeLayout>
            <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_above="@id/widgetStatusLayout"       
                    android:layout_alignParentTop="true"
             >      
                    <TextView 
                        android:id="@+id/widgetTitle" 
                        style="@style/WidgetTitle"
                    />

                    <TextView 
                        android:id="@+id/widgetText" 
                        style="@style/WidgetText"
                    />
            </LinearLayout>
    </RelativeLayout>

</FrameLayout>
4

1 に答える 1

0

私はそれを考え出した。アイコンの高さをより高い数値 (28 dp) に設定する必要がありました。アイコンは真の長方形ではないと思います (私は他の人にアイコンを作ってもらいました)。おそらく縦横比に問題がありました。

于 2012-07-13T00:46:35.437 に答える