Answer the question
In order to leave comments, you need to log in
When flipping the screen, two EditTexts appear, one overlaps the other, how to fix it?
I wrote a calculator, I used EditText for the number output field, the problem is that when I turn the screen, it looks like I have two EditTexts, as a result, the values \u200b\u200bare added to one, and the other is default, and it interferes
Answer the question
In order to leave comments, you need to log in
The problem is most likely in how you show the fragment.
You need to check if the fragment is already added, if added, either replace or show
// показываем нужный фрагмент
private void showFragment(Fragment fragment) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
if (fm.findFragmentByTag(TAG) == null) {
transaction.add(R.id.activity_content, fragment, TAG);
} else if (fragment.getClass().equals(fm.findFragmentByTag(TAG).getClass())){
transaction.show(fragment);
} else {
transaction.replace(R.id.activity_content, fragment, TAG);
}
//transaction.addToBackStack(fragment.getClass().getName());
transaction.commit();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question