View overlap Toolbar - android

I am trying do transparent toolbar that has to overlap other view. But conversely other view overlap toolbar.
In xml I specially used margintop for RelativeLayout that show overlapping. Actually I don't use marginTop for RelativeLayout.
xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.activitys.ActivityImage">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/action_bar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Фото"/>
</android.support.v7.widget.Toolbar>
<RelativeLayout
android:layout_marginTop="30dp"
android:id="#+id/img_slideshow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/img_border"
>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<kz.dreamwings.zhaksyadam.activity.util.CircleIndicator
android:id="#+id/indicator"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:padding="3dip"
android:background="#99000000"
android:layout_above="#+id/img_name"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</FrameLayout>

You are using FrameLayout which is basically for holding a single child. You cant manage the alignment of childrens in FrameLayout.
Your layout should be like this.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/action_bar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Фото" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:scrollbars="none"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout
android:id="#+id/img_slideshow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/img_border">
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<kz.dreamwings.zhaksyadam.activity.util.CircleIndicator
android:id="#+id/indicator"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:layout_above="#+id/img_name"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="#99000000"
android:padding="3dip" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

change your code like this:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#drawable/img_border"
tools:context=".activity.activitys.ActivityImage">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#android:color/transparent"
android:gravity="center">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/action_bar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Фото"/>
</android.support.v7.widget.Toolbar>
<RelativeLayout
android:layout_marginTop="30dp"
android:id="#+id/img_slideshow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
.
.
.

Try this: add toolbar after relative layout and remove top margin .
.i.e:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.activitys.ActivityImage">
<RelativeLayout
android:id="#+id/img_slideshow_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/img_border"
>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<kz.dreamwings.zhaksyadam.activity.util.CircleIndicator
android:id="#+id/indicator"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:padding="3dip"
android:background="#99000000"
android:layout_above="#+id/img_name"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/action_bar_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Фото"/>
</android.support.v7.widget.Toolbar>
</FrameLayout>

Related

Last CardView is not showing properly in DrawerLayout

I am trying to display cardViews on drawerLayout something like this:
CardView
But the last CardView is not showing properly.
My cardView.xml code looks like this :
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_margin="10dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Drinks"
android:id="#+id/posTxt"
android:padding="10dp"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/image"
android:padding="10dp"
android:src="#drawable/ghost"
android:layout_below="#+id/posTxt"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Name"
android:id="#+id/nameTxt"
android:padding="10dp"
android:textColor="#color/colorGreen"
android:layout_below="#+id/image"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" This is the best drink"
android:id="#+id/descTxt"
android:padding="10dp"
android:layout_below="#+id/nameTxt"
android:layout_alignParentLeft="true"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
and my activity_main.xml code looks like this:
<android.support.v4.widget.DrawerLayout
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:id="#+id/drawyerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hasan.tablayout.MainActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main"/>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:menu="#menu/navigation_menu"
android:layout_gravity="start"
app:headerLayout="#layout/navigation_header"/>
</android.support.v4.widget.DrawerLayout>
I added card_view:cardCornerRadius , card_view:cardElevation in my xml code. But i don't understand where is my mistake?

How do I change the cardview position to the bottom of the tablayout?

I tried to create a cardview consisting of five items in a fragment. However, the cardview position is always at the top of the layout. I tried using margin and align, but it didn't work.
How do I change the position of the cardview?
Here is my card_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android.support.v7.cardview="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="85dp"
android:orientation="vertical"
android:id="#+id/my_relative_layout"
>
<android.support.v7.widget.CardView
android:id="#+id/card_view"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="8dp"
android:backgroundTint="#E3F0F5"
android:layout_centerVertical="true"
card_view:cardCornerRadius="5dp"
card_view:elevation="14dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/iv_image"
android:src="#drawable/avatar1"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
/>
<TextView
android:textColor="#95989A"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_text"
android:layout_toRightOf="#+id/iv_image"
android:gravity="center"/>
<TextView
android:textColor="#95989A"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_blah"
android:text="Another RV Fragment"
android:layout_below="#+id/tv_text"
android:layout_toRightOf="#+id/iv_image"
android:layout_toEndOf="#+id/iv_image"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
Here is my activity_pendaftar.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
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="com.martin.app.donorkuyadmin.PendaftarActivity"
android:background="#drawable/background4">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:layout_height="wrap_content"
android:layout_width="match_parent"
layout="#layout/toolbar_pendaftar">
</include>
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tablayout"
app:tabMode="fixed"
app:tabGravity="fill">
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/viewpager">
</android.support.v4.view.ViewPager>
</RelativeLayout>
This is my screenshot:
Give an id to your AppBarLayout (say, id=action_bar) and then simply add layout_below="#id/action_bar" to your ViewPager:
<android.support.v4.view.ViewPager
android:layout_below="#id/action_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/viewpager">
</android.support.v4.view.ViewPager>
Use Coordinator layout instead of Relative layout and set layout_behavior property into view pager to appbar_scrolling_view_behavior.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include
layout="#layout/toolbar_pendaftar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.TabLayout
android:id="#+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed"></android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
Move your include statement outside the appbarlayout and align it to parent's bottom like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
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="com.martin.app.donorkuyadmin.PendaftarActivity"
android:background="#drawable/background4">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tablayout"
app:tabMode="fixed"
app:tabGravity="fill">
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/viewpager">
</android.support.v4.view.ViewPager>
<include
android:layout_height="wrap_content"
android:layout_width="match_parent"
layout="#layout/toolbar_pendaftar"
android:layout_alignParentBottom="true">
</include>
</RelativeLayout>

FragmentLayout overlapping content

The FraglemtLayout bar is overlapping the content of the page.
i.e. My TabLayout is overlapping the main content of the page.
This is MainActivity layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/lib/com.example.feelingoodlivinbeta.socialdreams_a1.MainMenuActivity"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.feelingoodlivinbeta.socialdreams_a1.MainMenuActivity">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" >
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
This is model layout contains cardview; I don't know where the problem is located
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="250dp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_below="#id/fragmantRecycler">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="56dp"
android:layout_height="match_parent"
android:layout_weight="0.06"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/socialdreamlogo" />
</LinearLayout>
<TextView
android:id="#+id/nameTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3.67"
android:padding="10dp"
android:text="TextView" />
</LinearLayout>
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="#drawable/placeholder" />
</LinearLayout>
</android.support.v7.widget.CardView>
Your problem seems to be related to this line:
xmlns:app="http://schemas.android.com/apk/lib/com.example.feelingoodlivinbeta.socialdreams_a1.MainMenuActivity"
replace it with:
xmlns:app="http://schemas.android.com/apk/res-auto"

Coordinate layout Overlapping container

I am using this layout to load the fragments in side it but when i run that on device it gives look like this.
Below is my code.Any suggest why framelayout is overlapping coordinate layout.
Thanks for help :)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/cl_root_inner_main"
android:layout_width="match_parent"
android:layout_height="#dimen/toolbar_height"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/tool_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:titleTextColor="#color/white"
app:popupTheme="#style/AppTheme.PopupOverlay">
<RelativeLayout
android:id="#+id/buttonsview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/btnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:padding="#dimen/x10"
android:src="#drawable/ic_arrow_back" />
<TextView
android:id="#+id/fragtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/select_district"
android:textColor="#color/white"
android:textSize="20sp"
android:visibility="invisible" />
<Button
android:id="#+id/btnPost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/x10"
android:layout_gravity="center_horizontal"
android:text="#string/post"
android:textColor="#color/white"
android:textSize="12sp"
android:theme="#style/blue_button" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
<FrameLayout
android:id="#+id/container"
android:background="#color/orange"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
this is a xml using coordinator layout, I think this will help you
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context="com.software.products.ui.activity.ToolbarUsedActivity"
android:layoutDirection="rtl">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<--!just use toolbar here-->
<com.software.android.view.ddToolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main2" />
</android.support.design.widget.CoordinatorLayout>

Layout pushing down content

Not sure what is going on in my layout but after the tabs, the content starts halfway down the screen...
These are the layouts in order from parent to child
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".Prof">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/tabs_profile" />
</android.support.design.widget.CoordinatorLayout>
tabs profile layout:
<!-- for Tabs -->
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorTabs"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextColor="#color/tabsTxtColor"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<include layout="#layout/content_profile" />
</android.support.design.widget.CoordinatorLayout>
content xml layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:gravity="center"
android:text="click THIS"
android:layout_alignParentBottom="true"
android:textColor="#color/tabsTxtColor"
android:background="#color/colorPrimary"/>
</RelativeLayout>
fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<RelativeLayout android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="300dp"
android:adjustViewBounds="true"
android:id="#+id/productDefaultPicture"
android:src="#drawable/default_product"
android:layout_above="#+id/hashes"/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/previousPicture"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_circled_left_48"/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/nextPicture"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_circled_right_48"/>
<View
android:background="#16000000"
android:layout_width="fill_parent"
android:layout_height="5dip"
android:id="#+id/break2"
android:layout_below="#+id/productDefaultPicture"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:id="#+id/hashes"
android:layout_alignParentBottom="true"
android:textSize="18sp"
android:textColor="#color/primary_dark_material_dark"
android:text="iPhone 6"/>
</RelativeLayout>
</LinearLayout>
Your 'hashes' (id) view is anchored to the bottom of the RelativeLayout, which fills the fragment.
It looks like everything else is positioned above the hashes view, so it is all anchored to the bottom of the fragment.
You can try and position things relative to the center or top of the RelativeLayout.

Categories

Resources