<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:la" />
<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:la" />
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:weightSum="3"
tools:context="com.sam.web.fragment.MainActivity">
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent">
<ListView
android:listSelector="#22ffc0"
android:id="@+id/listViewId"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
<LinearLayout
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent">
<fragment
android:name="com.sam.web.fragment.SamFragment"
android:id="@+id/fragmentId"
android:layout_width="match_parent"
android:layout_height="match_parent"></fragment>
</LinearLayout>
</LinearLayout>
==============================================================================
Fragment_main.xml
==================
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:background="#43ff22"
tools:context="com.sam.web.fragment.SulFragment">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/australia"
android:layout_width="match_parent"
android:layout_height="250dp" />
<TextView
android:textAlignment="center"
android:text="@string/Australia_details"
android:textSize="17sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
============================================================================
strings.xml
============
<resources>
<string name="app_name">Fragment</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="Australia_details">
Name:Australia
Languges:English
</string>
<string name="uk_details">
Name:United Kingdom
Languges:English
</string>
</resources>
===============================================================================
SamFragment.java
=================
package com.sam.web.fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class SamFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_sam, container, false);
}
}
=========================================================================
fragment_sul.xml
====================
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:background="#43ff22"
tools:context="com.sam.web.fragment.SamFragment">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/uk"
android:layout_width="match_parent"
android:layout_height="250dp" />
<TextView
android:textAlignment="center"
android:text="@string/uk_details"
android:textSize="17sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
=======================================================================
SulFragment.java
===============
package com.sam.web.fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class SulFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_sul, container, false);
}
}