I am working with Actionbar in android.
In my layout the Actionbar appears correctly. But my fragment's layout overlaps with Actionbar. See the below image.
And my layout file is below.
<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"
android:background="@drawable/myapp_bg"
tools:context="${relativePackage}.${activityClass}" >
<LinearLayout
android:id="@+id/myapp_user_info_container"
android:layout_width="match_parent"
android:layout_height="120dp"
android:orientation="horizontal"
android:background="@drawable/myapp_profile_bg"
>
<RelativeLayout
android:id="@+id/myapp_user_info_inner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
>
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="@dimen/myapp_circular_image_size"
android:layout_height="@dimen/myapp_circular_image_size"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:src="@drawable/username" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_weight="2.30"
android:orientation="vertical" >
<TextView
android:id="@+id/myapp_menu_sidebar_user_mailid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:layout_marginRight="15dp"
android:layout_marginTop="3dp"
android:layout_weight="1.15"
android:gravity="top"
android:textColor="#ffffff"
android:textSize="17sp" />
<TextView
android:id="@+id/myapp_menu_sidebar_user_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="15dp"
android:layout_marginTop="1dp"
android:layout_weight="1.15"
android:gravity="bottom"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/myapp_home_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_below="@+id/myapp_user_info_container"
android:layout_marginBottom="20dp"
/>
<include
android:id="@+id/myapp_footer_view_id"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
layout="@layout/myapp_footer"
android:visibility="gone"
/>
<!-- <ProgressBar
android:id="@+id/myapp_progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/> -->
What mistake I did with? I want the layout will start under the ActionBar. Is any other details need to make it better understanding?
I think this might help you:
https://developer.android.com/training/basics/actionbar/overlaying.html
The main idea is that if you are using
<item name="windowActionBarOverlay">true</item>
in your actionbar style you have to specify your margin by hand:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?android:attr/actionBarSize">
...
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With