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 ToggleButton。到目前为止一切正常。当然spinner需要一些条目,所以我在微调器中添加了属性:

android:entries="@array/myentries"

现在的问题是,它ToggleButton比微调器低一点,并且按钮ToggleButton被切断,可能是3或5行像素。

有人知道这里有什么问题吗?安卓是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 回答