小编hyp*_*ris的帖子

当复选框改变状态时如何做某事?

这是我的代码:

    <CheckBox
        android:id="@+id/sprint_checkbox"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/sprint_game" />

    <CheckBox
        android:id="@+id/marathon_checkbox"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/marathon" />

    <CheckBox
        android:id="@+id/never_ending_checkbox"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/never_ending" />
Run Code Online (Sandbox Code Playgroud)

我想要做的是"检测"其中一个被检查,然后将另外两个设置为"禁用",因此用户只能选择一个.我试图使用".setOnCheckedChangeListener",但我不能这样做,有人可以帮我一些代码吗?非常感谢!

checkbox android oncheckedchanged android-checkbox

11
推荐指数
1
解决办法
3万
查看次数

如何在CountDownTimer上添加和删除时间?

问题是:如何在倒计时期间从CountDownTimer添加或删除时间?

例如:用户做了好事:+ 5秒,用户做错了什么:-5秒.

有人可以帮我一些代码吗?

android timer countdown countdowntimer

2
推荐指数
1
解决办法
3198
查看次数

Android - 如何设置首次选择的操作栏选项卡?

这是我的代码:

    Tab tab = actionBar
            .newTab()
            .setText(R.string.friends)
            .setTabListener(
                    new TabListener<FriendsFragment>(this, "friends_list",
                            FriendsFragment.class));
    actionBar.addTab(tab);

    tab = actionBar
            .newTab()
            .setText(R.string.home)
            .setTabListener(
                    new TabListener<UserHomeFragment>(this, "user_home",
                            UserHomeFragment.class));
    actionBar.addTab(tab);

    tab = actionBar
            .newTab()
            .setText(R.string.highscores)
            .setTabListener(
                    new TabListener<HighscoresFragment>(this, "highscores",
                            HighscoresFragment.class));
    actionBar.addTab(tab);
Run Code Online (Sandbox Code Playgroud)

如何将"UserHome"设置为显示/选择的第一个选项卡?我现在想要它在中间.因此,当我的"TabActivity"开始时,它将是这样的:朋友 - 主页 - 高分榜

android android-actionbar android-tabs

1
推荐指数
1
解决办法
6410
查看次数