Android Studio - Fragment Statico

Android Studio - Fragment Statico

First.java

package com.example.fragment_static;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class first extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_first, container, false);
}
}

<?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"
tools:context=".MainActivity">

</LinearLayout>

<?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"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.first">
</fragment>

</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.first">
</fragment>

<fragment
android:id="@+id/frag_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.second">
</fragment>

</androidx.appcompat.widget.LinearLayoutCompat>

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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:weightSum="2"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.first">
</fragment>

<fragment
android:id="@+id/frag_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.second">
</fragment>

</androidx.appcompat.widget.LinearLayoutCompat>

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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:weightSum="2"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.first">
</fragment>

<fragment
android:id="@+id/frag_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.fragment_static.second">
</fragment>

</androidx.appcompat.widget.LinearLayoutCompat>

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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:weightSum="2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:name="com.example.fragment_static.first">
</fragment>

<fragment
android:id="@+id/frag_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:name="com.example.fragment_static.second">
</fragment>

</androidx.appcompat.widget.LinearLayoutCompat>

<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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:weightSum="2"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<fragment
android:id="@+id/frag_first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:name="com.example.fragment_static.first">
</fragment>

<fragment
android:id="@+id/frag_second"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:name="com.example.fragment_static.second">
</fragment>

</androidx.appcompat.widget.LinearLayoutCompat>

About Post Author

pasquale.clarizio

errore: Content is protected !!
Advertisment ad adsense adlogger