gpt4 book ai didi

Android:自定义微调器大小问题

转载 作者:数据小太阳 更新时间:2023-10-29 02:49:18 25 4
gpt4 key购买 nike

我已经制作了一个自定义微调器,但尺寸并不是我想要的。微调器变得太大以获得我需要的列表中的间距。我希望能够独立于微调器按钮的大小来调整微调器行的大小。我希望微调器变薄,然后我希望截面行的间距很大。 (见底部图片):

当前微调器行的 xml 是这样的:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="5dip">
<ImageView android:layout_width="32sp" android:src="@drawable/icon"
android:id="@+id/spinnerimage" android:layout_height="32sp" />
<TextView android:textSize="22sp" android:textStyle="bold" android:textColor="#000"
android:layout_width="fill_parent" android:id="@+id/category"
android:layout_height="fill_parent" android:paddingLeft="5sp" />
</TableRow>
</TableLayout>

我想使用相对布局,但表格布局给了我更好的间距。如果我尝试调整高度,它会切断行中的文本和图标。我的 main.xml 中的微调器是:

        <Spinner android:id="@+id/catspinner"
android:layout_marginLeft="25dip" android:layout_marginRight="25dip"
android:layout_width="fill_parent" android:layout_centerHorizontal="true"
android:layout_height="wrap_content" android:prompt="@string/prompt"
android:background="@drawable/yellow_btn"
android:layout_centerVertical="true" android:drawSelectorOnTop="true" />

enter image description here

我想让微调器的大小与标准 android 微调器(右侧)相同。我的微调器目前已反转,微调器太大,行间距太小。

有什么想法吗?

最佳答案

在设置适配器时说 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);这应该工作...

关于Android:自定义微调器大小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7011169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com