У меня проблема с макетом моего приложения.У меня есть 2 фрагмента, которые должны быть отображены в деятельности.Он отлично работает, но в «Макете» кто-то отображает EditText дважды, а также друг за другом.Вы можете видеть, что намек на EditText темнее, и как только я что-то наберу в TextEdit, я вижу другой EditText, независимо видимый на заднем плане.Также TextView и Switch отображаются дважды, как вы можете видеть из темноты внешнего вида:
![Screenshot of the glitch](https://i.stack.imgur.com/a0Ywp.png)
Файлы макетов: activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".QuickSteuerActivity">
<fragment
android:id="@+id/calculation_fragment"
android:name="de.immozukunft.quicksteuer.CalculationFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<fragment
android:id="@+id/settings_overview_fragment"
android:name="de.immozukunft.quicksteuer.SettingsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/> </LinearLayout>
frag_calculation.xml (это место, где находится EditText, Switch и т.д.)1019 * (2.Fragment)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_settings_overview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/current_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:padding="10dp"
android:text="@string/overview_settings"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</FrameLayout>
Я также могу предоставить Java-файлы при необходимости или любые дополнительные файлы.Я просто не хотел раздувать пост.
Если у кого-нибудь есть какие-либо дополнительные советы (стиль кодирования и т. Д.), Пожалуйста, дайте мне знать, я относительно новичок в программировании на Android:)
спасибо заранее
THE-E
РЕДАКТИРОВАТЬ:
Я думаю, что я испортил макет с менеджером фрагментов.Но я не уверен.Потому что теперь я вижу даже какой-то PreferenceFragment.
onCreate () Действия:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); //Layout
manager = getSupportFragmentManager(); //Fragment-Manager
CalculationFragment calculationFragment = new CalculationFragment(); //create calculation fragment
SettingsOverviewFragment settingsOverviewFragment = new SettingsOverviewFragment(); //create settings overview fragment
calculationFragment.setArguments(getIntent().getExtras()); //I don't know what happens here
settingsOverviewFragment.setArguments(getIntent().getExtras()); //I don't know what happens here either
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.calculation_fragment, calculationFragment); //add calculation fragment to the fragment transaction
transaction.add(R.id.settings_overview_fragment, settingsOverviewFragment); //add settings overview fragment to the fragment transaction
transaction.commit(); //commit the transaction
}