0

私は持っている

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/LinearLayoutPlayer"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <Spinner 
            android:id="@+id/Spinner01"
            android:layout_width="fill_parent"  
            android:layout_height="wrap_content"
            android:layout_weight="100" />

        <ToggleButton 
            android:text="@+id/ToggleButton01"
            android:id="@+id/ToggleButton01" 
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_weight="1" />
</LinearLayout>

aspinnerと a の隣に aが表示されますToggleButton。これまでのところすべて問題ありません。もちろん、spinnerいくつかのエントリが必要なので、スピナーに次の属性を追加します。

android:entries="@array/myentries"

現在の問題は、ToggleButtonがスピナーより少し低く、 のボタンToggleButtonが切り取られていることです。おそらく 3 ~ 5 行のピクセルです。

ここで何が間違っているのか誰にも分かりますか? Android はバージョン 2.2 です

ありがとう!

4

1 に答える 1

2

ToggleButton新しいであなたを包んでみてくださいLinearLayout。その場合、xmlは次のようになります。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayoutPlayer"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <Spinner 
        android:id="@+id/Spinner01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:entries="@array/planets_array"
        android:layout_weight="100">
    </Spinner>
    <LinearLayout 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
        <ToggleButton
            android:text="@+id/ToggleButton01"
            android:id="@+id/ToggleButton01" 
            android:layout_height="wrap_content"
            android:layout_width="wrap_content" 
            android:layout_weight="1">
        </ToggleButton>
    </LinearLayout>
</LinearLayout>
于 2011-01-04T17:27:42.963 に答える