安卓:获取选中的复选框值复选框

2023-09-04 11:00:30 作者:感情刀下鬼

我需要选中的复选框值时,单击按钮。 Java的code:

  dualcamera1 =(复选框)findViewById(R.id.C​​amera1_DualDisplay);
dualcamera2 =(复选框)findViewById(R.id.C​​amera2_DualDisplay);
dualcamera3 =(复选框)findViewById(R.id.C​​amera3_DualDisplay);
dualcamera4 =(复选框)findViewById(R.id.C​​amera4_DualDisplay);
dualdisplay =(按钮)dialog.findViewById(R.id.DisplayDualVideo);
 

解决方案

这可以帮助你:

  //返回此视图的启用状态。
dualcamera1.isEnabled()如果这一观点被启用//返回true,否则为false。

//表示鉴于当前是否处于pressed状态。
dualcamera1.is pressed()如果这一观点被启用//返回true,否则为false。
 
在js中怎样获得checkbox里选中的多个值

I need to get checked checkbox values when button clicked. Java Code:

dualcamera1 = (CheckBox)findViewById(R.id.Camera1_DualDisplay);
dualcamera2 = (CheckBox)findViewById(R.id.Camera2_DualDisplay);
dualcamera3 = (CheckBox)findViewById(R.id.Camera3_DualDisplay);
dualcamera4 = (CheckBox)findViewById(R.id.Camera4_DualDisplay);
dualdisplay = (Button)dialog.findViewById(R.id.DisplayDualVideo);

解决方案

This may help you:

//Returns the enabled status for this view. 
dualcamera1.isEnabled()  //return True if this view is enabled, false otherwise. 

//Indicates whether the view is currently in pressed state.
dualcamera1.isPressed() //return True if this view is enabled, false otherwise.