Answer the question
In order to leave comments, you need to log in
How to make the ExtractEditText object visible/invisible using the Switch switch?
Available in the activate switch Switch and ExtractEditText. What code is required to be written so that the ExtractEditText object was not visible in the inactive Switch switch, but appeared when the Switch was on?
Answer the question
In order to leave comments, you need to log in
Hello!
1) add view component switch & edittext to activity.
2) add the following structure:
if (switch1.isChecked()) {
editText.setVisibility(View.VISIBLE);
} else {
editText.setVisibility(View.GONE);
//или editText.setVisibility(View.INVISIBLE);
}
There was not enough event handler on the switcher, the issue is resolved.
switch1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//проверяем свитчер если он активен, то окно с датой появляется
if (isChecked){
DatePlain.setVisibility(View.VISIBLE);
} else {
DatePlain.setVisibility(View.GONE);
}
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question