开发者

Checkbox's Text click Events

I am using checkbox for the purpose of checking "Term & Condications".

if user had selected only checkbox (Square icon) that means terms are accepted and if not then terms are not accepted, but 开发者_JAVA百科if user clicks on that checkbox's text then i should be able to view "terms & condications" page.

Thanks.


take one checkbox and on Textview(better to use button ) setOnClickListener on textView to show T&C . check ckeckBox status throgh checkbox.ischecked() and work accordingly.


I don't know exactly what you want but you can do it with the checkbox. You need to create your checkbox and then you can check if checkbox is checked or not.

For example:

 final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
         if (checkBox.isChecked()) {
             Toast.makeText(getApplicationContext(), "You accepted the Terms", Toast.LENGTH_SHORT);
}
         else {
             Toast.makeText(getApplicationContext(), "You haven't accepted the Terms", Toast.LENGTH_SHORT);
}

Here is one example, which can help to understand it: http://developer.android.com/reference/android/widget/CheckBox.html

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜