XML : how much fragments do I require?

I currently have 10 activities. One is the menu activities and the rest are the categories activities and I currently have created one fragment called menu fragment. How much more fragments will I need to create?

I want to create from fragments from menu pages to other pages as well. for example I want to display menu page on one side and the categories on the other side once clicked on one of the activities.

I can only find list view and detail examples. Do I need to create fragments for each activity and how much fragments need creating. Do I create a new large layout xml.file Please advise.

actvitymain.XML

  <RelativeLayout 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"        tools:context=".MainActivity">        <include          android:id="@+id/tool_bar"          layout="@layout/tool_bar"          ></include>          <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:id="@+id/linearLayout"          android:weightSum="1"          android:background="#ffffff"          android:layout_below="@+id/tool_bar">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/museum_icon"              android:background="#ffffff"              android:src="@drawable/museumicon"              android:scaleType="fitXY" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/theatre_icon"              android:background="#00000000"              android:src="@drawable/theatreicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/museum_icon"              android:layout_toEndOf="@+id/museum_icon"              android:scaleType="fitXY" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/fooddrink_icon"              android:src="@drawable/foodicon"              android:background="#ffffff"              android:layout_gravity="center_vertical"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/theatre_icon"              android:layout_toEndOf="@+id/theatre_icon"              android:scaleType="fitXY" />        </RelativeLayout>        <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:layout_below="@+id/linearLayout"          android:layout_alignParentLeft="true"          android:layout_alignParentStart="true"          android:id="@+id/linearLayout2"          android:background="#ffffff">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/leisure_icon"              android:background="#ffffff"              android:scaleType="fitXY"              android:src="@drawable/leisureicon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/shopping_icon"              android:background="#00000000"              android:scaleType="fitXY"              android:src="@drawable/shoppingicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/leisure_icon"              android:layout_toEndOf="@+id/leisure_icon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/histroy_icon"              android:src="@drawable/historicalicon"              android:scaleType="fitXY"              android:background="#ffffff"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/shopping_icon"              android:layout_toEndOf="@+id/shopping_icon" />      </RelativeLayout>      <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:id="@+id/linearLayout3"          android:layout_below="@+id/linearLayout2"          android:layout_alignParentLeft="true"          android:layout_alignParentStart="true"          android:background="#ffffff"          android:layout_alignParentBottom="true">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/park_icon"              android:background="#ffffff"              android:scaleType="fitXY"              android:src="@drawable/parkicon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/familyfun_icon"              android:background="#00000000"              android:scaleType="fitXY"              android:src="@drawable/familyfunicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/park_icon"              android:layout_toEndOf="@+id/park_icon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/travelinfor_icon"              android:src="@drawable/travelicon"              android:scaleType="fitXY"              android:background="#ffffff"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/familyfun_icon"              android:layout_toEndOf="@+id/familyfun_icon" />      </RelativeLayout>      </RelativeLayout>    

menufragment.XML

  <RelativeLayout 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"        tools:context=".MenuFragment">        <include          android:id="@+id/tool_bar"          layout="@layout/tool_bar"          ></include>          <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:id="@+id/linearLayout"          android:weightSum="1"          android:background="#ffffff"          android:layout_below="@+id/tool_bar">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/museum_icon"              android:background="#ffffff"              android:src="@drawable/museumicon"              android:scaleType="fitXY" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/theatre_icon"              android:background="#00000000"              android:src="@drawable/theatreicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/museum_icon"              android:layout_toEndOf="@+id/museum_icon"              android:scaleType="fitXY" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/fooddrink_icon"              android:src="@drawable/foodicon"              android:background="#ffffff"              android:layout_gravity="center_vertical"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/theatre_icon"              android:layout_toEndOf="@+id/theatre_icon"              android:scaleType="fitXY" />        </RelativeLayout>        <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:layout_below="@+id/linearLayout"          android:layout_alignParentLeft="true"          android:layout_alignParentStart="true"          android:id="@+id/linearLayout2"          android:background="#ffffff">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/leisure_icon"              android:background="#ffffff"              android:scaleType="fitXY"              android:src="@drawable/leisureicon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/shopping_icon"              android:background="#00000000"              android:scaleType="fitXY"              android:src="@drawable/shoppingicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/leisure_icon"              android:layout_toEndOf="@+id/leisure_icon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/histroy_icon"              android:src="@drawable/historicalicon"              android:scaleType="fitXY"              android:background="#ffffff"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/shopping_icon"              android:layout_toEndOf="@+id/shopping_icon" />      </RelativeLayout>      <RelativeLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="170dp"          android:id="@+id/linearLayout3"          android:layout_below="@+id/linearLayout2"          android:layout_alignParentLeft="true"          android:layout_alignParentStart="true"          android:background="#ffffff"          android:layout_alignParentBottom="true">            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/park_icon"              android:background="#ffffff"              android:scaleType="fitXY"              android:src="@drawable/parkicon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/familyfun_icon"              android:background="#00000000"              android:scaleType="fitXY"              android:src="@drawable/familyfunicon"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/park_icon"              android:layout_toEndOf="@+id/park_icon" />            <ImageButton              android:layout_width="125dp"              android:layout_height="170dp"              android:id="@+id/travelinfor_icon"              android:src="@drawable/travelicon"              android:scaleType="fitXY"              android:background="#ffffff"              android:layout_alignParentTop="true"              android:layout_toRightOf="@+id/familyfun_icon"              android:layout_toEndOf="@+id/familyfun_icon" />      </RelativeLayout>      </RelativeLayout>    

museumactivity. XML

      <RelativeLayout 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"            tools:context=".MainActivity">            <include              android:id="@+id/tool_bar"              layout="@layout/tool_bar"              ></include>              <RelativeLayout              android:orientation="horizontal"              android:layout_width="match_parent"              android:layout_height="170dp"              android:id="@+id/linearLayout"              android:weightSum="1"              android:background="#ffffff"              android:layout_below="@+id/tool_bar">                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/museum_icon"                  android:background="#ffffff"                  android:src="@drawable/museumicon"                  android:scaleType="fitXY" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/theatre_icon"                  android:background="#00000000"                  android:src="@drawable/theatreicon"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/museum_icon"                  android:layout_toEndOf="@+id/museum_icon"                  android:scaleType="fitXY" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/fooddrink_icon"                  android:src="@drawable/foodicon"                  android:background="#ffffff"                  android:layout_gravity="center_vertical"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/theatre_icon"                  android:layout_toEndOf="@+id/theatre_icon"                  android:scaleType="fitXY" />            </RelativeLayout>            <RelativeLayout              android:orientation="horizontal"              android:layout_width="match_parent"              android:layout_height="170dp"              android:layout_below="@+id/linearLayout"              android:layout_alignParentLeft="true"              android:layout_alignParentStart="true"              android:id="@+id/linearLayout2"              android:background="#ffffff">                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/leisure_icon"                  android:background="#ffffff"                  android:scaleType="fitXY"                  android:src="@drawable/leisureicon" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/shopping_icon"                  android:background="#00000000"                  android:scaleType="fitXY"                  android:src="@drawable/shoppingicon"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/leisure_icon"                  android:layout_toEndOf="@+id/leisure_icon" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/histroy_icon"                  android:src="@drawable/historicalicon"                  android:scaleType="fitXY"                  android:background="#ffffff"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/shopping_icon"                  android:layout_toEndOf="@+id/shopping_icon" />          </RelativeLayout>          <RelativeLayout              android:orientation="horizontal"              android:layout_width="match_parent"              android:layout_height="170dp"              android:id="@+id/linearLayout3"              android:layout_below="@+id/linearLayout2"              android:layout_alignParentLeft="true"              android:layout_alignParentStart="true"              android:background="#ffffff"              android:layout_alignParentBottom="true">                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/park_icon"                  android:background="#ffffff"                  android:scaleType="fitXY"                  android:src="@drawable/parkicon" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/familyfun_icon"                  android:background="#00000000"                  android:scaleType="fitXY"                  android:src="@drawable/familyfunicon"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/park_icon"                  android:layout_toEndOf="@+id/park_icon" />                <ImageButton                  android:layout_width="125dp"                  android:layout_height="170dp"                  android:id="@+id/travelinfor_icon"                  android:src="@drawable/travelicon"                  android:scaleType="fitXY"                  android:background="#ffffff"                  android:layout_alignParentTop="true"                  android:layout_toRightOf="@+id/familyfun_icon"                  android:layout_toEndOf="@+id/familyfun_icon" />          </RelativeLayout>          </RelativeLayout>    

theatreactivity.XML

  <RelativeLayout 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"        tools:context=".MainActivity">        <include          android:id="@+id/tool_bar"          layout="@layout/tool_bar"          ></include>        <fragment          android:id="@+id/Menufragment"          android:name="com.bradvisor.bradvisor.MenuFragment"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:layout_alignParentBottom="true"          android:layout_alignParentLeft="true"          android:layout_alignParentRight="true"          android:layout_alignParentTop="true"          tools:layout="@layout/fragment_menu" />          <LinearLayout          android:orientation="vertical"          android:layout_width="match_parent"          android:layout_height="260dp"          android:layout_below="@+id/tool_bar"          android:layout_alignParentRight="true"          android:layout_alignParentEnd="true"          android:weightSum="1"          android:id="@+id/linearLayout4">            <ImageButton              android:layout_width="match_parent"              android:layout_height="match_parent"              android:id="@+id/logo"              android:scaleType="fitCenter"              android:src="@drawable/logofinal"              android:background="#ffffff" />      </LinearLayout>        <LinearLayout          android:orientation="vertical"          android:layout_width="match_parent"          android:layout_height="260dp"          android:layout_alignParentBottom="true"          android:layout_alignParentLeft="true"          android:layout_alignParentStart="true"          android:layout_below="@+id/linearLayout4" >            <ImageButton              android:layout_width="match_parent"              android:layout_height="match_parent"              android:id="@+id/theatrehead"              android:scaleType="fitXY"              android:src="@drawable/theatrehead"              android:background="#ffffff" />      </LinearLayout>    </RelativeLayout>     

No comments:

Post a Comment