Skip to content Skip to sidebar Skip to footer

Android - Multiple Fragments In One Tab

I searched a lot in the web about the possibility to have multiple fragments in one action bar tab. This question comes closest to my needs but the code is not working. Is there an

Solution 1:

I was looking for a solution to the same Topic, and found this, which comes in quite handy.

<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="match_parent"><fragmentandroid:name="com.example.news.ArticleListFragment"android:id="@+id/list"android:layout_weight="1"android:layout_width="0dp"android:layout_height="match_parent" /><fragmentandroid:name="com.example.news.ArticleReaderFragment"android:id="@+id/viewer"android:layout_weight="2"android:layout_width="0dp"android:layout_height="match_parent" /></LinearLayout>

so Reference your Fragments and inflate it, just like a normal Fragment

Post a Comment for "Android - Multiple Fragments In One Tab"