0

バージョン情報ダイアログを作成したい。

ダイアログの高さに「wrap_content」を使用しており、テキスト ボックス メッセージをコードで設定しています。

何らかの理由で、ダイアログが大きくなり、上部に空の黒いスペースがあります。

ダイアログがコンテンツのサイズに収まりません。

これが私のダイアログレイアウトです:

<?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="wrap_content" > 

    <RelativeLayout
    android:id="@+id/titleLayout"
    android:layout_width="fill_parent"
    android:layout_height="40dip"
    android:background="#EBEBEB" > 


        <ImageView 
        android:id="@+id/ivAbout"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"        
        android:src="@drawable/ic_dunk"
        android:layout_marginRight="10dip"
        android:layout_centerVertical="true"/>

        <TextView
        android:id="@+id/tvAboutTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#08BCBF"
        android:textSize="20sp"
        android:paddingRight="10dip"
        android:layout_toLeftOf="@+id/ivAboutDunk"
        android:layout_centerVertical="true"
        android:text="blabla" 
        />

    </RelativeLayout>    
    <View
        android:id="@+id/lineSeperator"
        android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:background="#08BCBF"
        android:layout_below="@+id/titleLayout"
         />

    <RelativeLayout
    android:id="@+id/aboutStoryLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/lineSeperator"
    android:background="#FFFFFF" > 
    <TextView
        android:id="@+id/tvAboutStory"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#000000"
        android:gravity="right"
        android:layout_marginRight="12dip"
        android:layout_marginTop="10dip"
        android:text="bla" 
        android:textSize="16sp"
        />    
    </RelativeLayout>

    <RelativeLayout
    android:id="@+id/aboutButtonsLayout"
    android:layout_width="fill_parent"
    android:layout_height="40dip"
    android:layout_below="@+id/aboutStoryLayout"
    android:background="#BDBDBD" >
     <Button
        android:id="@+id/dialogButtonOK"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="OK"
        android:layout_centerInParent="true"        
        />
    </RelativeLayout>      
</RelativeLayout>
4

1 に答える 1

0

そのレイアウトを使用して、dialog.setContentView(View) を介してダイアログにコンテンツを追加している場合、上部の黒いスペースはダイアログの未使用のタイトルであると思われます。その場合、dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) を使用して、タイトル領域を非表示/削除できます。

于 2012-09-10T09:47:52.377 に答える