XML : Title Bar with Fragment overlap with list view

I'm beginner in Android. I have a title bar which is separately placed in tool_bar.xml . Now i have two fragments. From one fragment i create a new activity which have to include tool_bar.xml (title bar). The problem is when i 'include' tool_bar.xml in newly create activty's xml file. The title bar overlaps with list-view.

I have also tried custom title bar method in On-create method but it didn't work. I think inclusion of tool_bar.xml will be the way but it overlaps with list-view.

Tool_bar.xml:

  <?xml version="1.0" encoding="utf-8"?>  <android.support.v7.widget.Toolbar  android:layout_height="wrap_content"  android:layout_width="match_parent"  android:background="@color/ColorPrimary"  android:elevation="2dp"  android:theme="@style/Base.ThemeOverlay.AppCompat.Dark"  xmlns:android="http://schemas.android.com/apk/res/android"  android:layout_alignParentTop="true"/>    

Activty_category_blogs.xml(XML of newly created activty)

  <?xml version="1.0" encoding="utf-8"?>    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"  android:layout_height="wrap_content" tools:context="com.example.talha.test_fragement.Category_Blogs"  xmlns:ads="http://schemas.android.com/apk/res-auto">  <include layout="@layout/tool_bar" />  <FrameLayout  android:layout_width="fill_parent"      android:layout_height="wrap_content">      <ListView android:id="@android:id/list" android:layout_width="fill_parent"          android:layout_height="wrap_content"          android:layout_above="@+id/adView" android:divider="#b5b5b5"          android:dividerHeight="1dp"          android:layout_alignParentBottom="true"          />          <TextView android:id="@android:id/empty" android:layout_width="match_parent"          android:layout_height="match_parent" android:gravity="center"          android:layout_gravity="right|top" />    </FrameLayout>    

Edited :

Oncreate Method:

  protected void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.activity_category__blogs);      Intent intent = getIntent();      String message = intent.getStringExtra(Tab2.EXTRA_MESSAGE);      String link = message + "?feed=titles";      Log.d("ye category click krne par next activity me ye link bnta hy parsing ke liye",link);      loadPage(link);  }    

No comments:

Post a Comment