如何在打开前设置微调器

问题描述 投票:-2回答:1

我不知道如何设置检查默认项目。

我想在开始时检查此默认项目。这该怎么做?

<com.toptoche.searchablespinnerlibrary.SearchableSpinner
                android:spinnerMode="dialog"
                android:id="@+id/sex"
                android:layout_width="match_parent"
                android:layout_height="wrap_conten"/>

    <com.toptoche.searchablespinnerlibrary.SearchableSpinner
                android:spinnerMode="dialog"
                android:id="@+id/category"
                android:layout_width="match_parent"
                android:layout_height="wrap_conten"/>

在课堂上

            final ArrayAdapter<String> adapterSex = new ArrayAdapter<String>(
                            SearchActivity.this,
                            android.R.layout.simple_list_item_single_choice,
                            listSex);

            sexS.setAdapter(adapterSex);

           final ArrayAdapter<String> adapterCategory = new ArrayAdapter<String(
                            SearchActivity.this,
                            android.R.layout.simple_list_item_single_choice,
                            listCategory);

            categoryS.setAdapter(adapterCategory);
android spinner
1个回答
0
投票

你可以在java中输入:

CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox1);
if (checkBox.isChecked()) {
    checkBox.setChecked(false);
}

或者用XML:

android:checked="false"
© www.soinside.com 2019 - 2024. All rights reserved.