2

この回答を検索しようとしましたが、回答に最も近いのはandroid:resizable = "true"を追加することでしたが、これは非推奨です。この質問に答えられた場合はお詫び申し上げますが、答えられた場合は見つかりませんでした。

とにかく、私のアプリは画面全体を埋めていません。私が使用していた方法はAndroid2.2で機能していましたが、現在2.3エミュレーターを使用しており、機能していません。これが実際に問題なのかどうかはわかりません。

今問題に...

温度変換アプリを作成しています(はい、宿題です)。LinearLayoutのlayout_widthとheightにfill_parentと言っても、アプリが画面全体に表示されません。私が見た提案は、RelativeLayoutを使用することでした。これは、私が推測できることですが、解決策ではなく、バンドエイドのようです。これはうまくいかないのですか?

これが私のコードです:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:background="@color/white"
    >

    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Temperature Converter"
        android:textColor="@color/black"
        />

    <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/convertGroup"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
        <RadioButton android:id="@+id/CtoF"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Celsius to Fahrenheit"
            android:textColor="@color/black"
            />
        <RadioButton android:id="@+id/FtoC"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Fahrenheit to Celsius"
            android:textColor="@color/black"
            />
    </RadioGroup>

    <EditText
        android:id="@+id/tempInput"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:hint="Temperature"
    />

    <TextView  
        android:id="@+id/converted"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/black"
    />
</LinearLayout>

結果は次のとおりです。

ここに画像の説明を入力してください

4

1 に答える 1

5

アプリケーションタグの後にmenifestに以下のコードを追加します

<supports-screens android:resizeable="true"
                      android:smallScreens="true" 
                      android:normalScreens="true" 
                      android:largeScreens="true"

                      android:anyDensity="true" />
于 2012-02-29T18:09:06.493 に答える