I need an example-tutorial how to activate and deactivate an element in preference activity.

For example in the picture below when the Wi-Fi check box is unselected I can not touch the Network notification check box and it turns gray, when the Wi-Fi check box is selected then I can touch the other check box.

Also how can I populate the Add Wi-Fi network tab when the whi-fi checkbox is enabled?