In my placeOrder activity navigation drawer is not starting from the top side of device screen as you can see in the scrrenshot of emulator.
this is my xml file in which i have implemented navigation drawer.
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/drawer_layout"
tools:context="com.e_prints.myapplication.PlaceOrder">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/nav_container"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/container"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/t_placeorder"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow>
<TextView
android:id="#+id/tv_psize"
android:text="#string/p_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_column="1"
/>
<Spinner
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/size"
android:entries="#array/paper_size"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:spinnerMode="dropdown"
android:layout_column="1" />
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_pcolor"
android:layout_width="wrap_content"
android:text="#string/p_color"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_column="1"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="#array/color"
android:id="#+id/color"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"></Spinner>
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_pbinding"
android:layout_width="wrap_content"
android:text="#string/p_binding"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_column="1"/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/binding"
android:entries="#array/binding"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
></Spinner>
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_ptype"
android:layout_width="wrap_content"
android:text="#string/p_type"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_column="1"/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/type"
android:entries="#array/type"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
></Spinner>
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_pattach"
android:layout_width="wrap_content"
android:text="#string/p_attach"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_marginTop="20dp"
/>
<Button
android:id="#+id/b_browse"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:background="#color/colorPrimary"
android:textColor="#color/white"
android:text="#string/b_browse"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/selected"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:id="#+id/file_path"
android:text="#string/file_path"
android:layout_column="2"
/>
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_pncpoies"
android:layout_width="wrap_content"
android:text="#string/p_copies"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_column="1"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/et_ncpoies"
android:hint="#string/p_ncopies"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
/>
</TableRow>
<TableRow>
<TextView
android:id="#+id/tv_ppgnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/pgnum"
android:layout_marginTop="20dp"
android:layout_column="1"
/>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:id="#+id/radiogroup1"
android:layout_column="2"
android:layout_marginLeft="20dp"
>
<RadioButton
android:text="#string/Poption1"
android:id="#+id/rb_poption1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RadioButton
android:text="#string/poption2"
android:id="#+id/rb_poption2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</RadioGroup>
</TableRow>
<TableRow>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/custom_print"
android:hint="1-30,50,55,60-90,100"
android:layout_column="2"
android:layout_marginLeft="20dp"
android:visibility="invisible"
/>
</TableRow>
</TableLayout>
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/t_placeorder"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:id="#+id/radiogroup">
<RadioButton
android:text="#string/p_homed"
android:id="#+id/rb_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:text="#string/pickup"
android:id="#+id/rb_pick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onRadioButtonClicked"
android:layout_marginLeft="50dp"
/>
</RadioGroup>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/address"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_below="#+id/radiogroup"
>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/b_proceed"
android:id="#+id/b_proceed"
android:layout_below="#id/address"
android:layout_marginTop="20dp"
android:background="#color/colorPrimary"
android:textColor="#color/white"
android:onClick="OnOrder"
/>
</RelativeLayout>
</ScrollView>
</FrameLayout>
<android.support.design.widget.NavigationView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:menu="#menu/nav_menu"
android:id="#+id/navigatiom_view"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"/>
You need to make DrawerLayout as parent..Try this way it will help you
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
New App Compat library support this feature all you need to do is use toolbar instead of Action bar its more customizable than action bar and relatively easy to use than Action bar.
Add this to your styles.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="dialogTheme">#style/Theme.Dialog</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark" />
Apply this theme to your App in manifest.xml
<application
....
....
android:theme="#style/AppTheme">
Now create your layout like this
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
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.v4.widget.DrawerLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/drawer_layout"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/myAppBar"
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"
app:title="Jewellery"/>
</android.support.design.widget.AppBarLayout>
<!--Your Layout Here-->
<RelativeLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/tabs"
android:id="#+id/scroll"
android:scrollbars="none">
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
</ScrollView>
</RelativeLayout>
<!-----Layout Ends-->
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header"/>
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>
Now in your Main Activity
Toolbar toolbar=(Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if(getSupportActionBar()!=null){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close);
mDrawerLayout.addDrawerListener(mDrawerToggle);
mDrawerToggle.syncState();
Related
How to add top drawer and bottom tab navigation in whole application?
I tried to combine 2 activity in android studio and its causing design issue. Its not working
For the bottom navigation
https://developer.android.com/reference/android/support/design/widget/BottomNavigationView
For Top drawer exaplain a little what exactly you want
You can achieve this throughout your whole Project in this way.
Use this as an activity_main.xml like as your MainActivity.java class.
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="#layout/app_bar_home"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="#dimen/dp_180"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/top_lay"
android:layout_width="match_parent"
android:layout_height="#dimen/nav_header_height"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:theme="#style/ThemeOverlay.AppCompat.Dark">
<RelativeLayout
android:id="#+id/userimageLay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<com.team.helperclasses.CircleImageView
android:id="#+id/userimage"
android:layout_width="#dimen/dp_100"
android:layout_height="#dimen/dp_100"
android:src="#mipmap/side_menu_profile_"
app:civ_border_color="#color/colorPrimary"
app:civ_border_overlay="true"
app:civ_border_width="1dp" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/editProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/top_lay"
android:paddingBottom="#dimen/dp_5"
android:paddingTop="#dimen/dp_5">
<TextView
android:id="#+id/editProfileText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/editProfileImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/dp_8"
android:text="#string/editProfile"
android:textColor="#color/dull_black"
android:textSize="#dimen/sp_18" />
<ImageView
android:id="#+id/editProfileImage"
android:layout_width="#dimen/dp_45"
android:layout_height="#dimen/dp_45"
android:layout_centerHorizontal="true"
android:src="#mipmap/side_menu_profile" />
</RelativeLayout>
<View
android:id="#+id/editProfiledivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/editProfile"
android:background="#color/light_black" />
<RelativeLayout
android:id="#+id/sharedWall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/editProfile"
android:paddingBottom="#dimen/dp_5"
android:paddingTop="#dimen/dp_5">
<TextView
android:id="#+id/sharedWallText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/shareWallImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/dp_8"
android:text="#string/sharedWall"
android:textColor="#color/dull_black"
android:textSize="#dimen/sp_18" />
<ImageView
android:id="#+id/shareWallImage"
android:layout_width="#dimen/dp_45"
android:layout_height="#dimen/dp_45"
android:layout_centerHorizontal="true"
android:src="#mipmap/wall" />
</RelativeLayout>
<View
android:id="#+id/shareWallDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/sharedWall"
android:background="#color/light_black" />
<RelativeLayout
android:id="#+id/changeLang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/shareWallDivider"
android:paddingBottom="#dimen/dp_5"
android:paddingTop="#dimen/dp_5">
<TextView
android:id="#+id/changeLangText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/changeLangImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/dp_8"
android:text="#string/changeLanguage"
android:textColor="#color/dull_black"
android:textSize="#dimen/sp_18" />
<ImageView
android:id="#+id/changeLangImage"
android:layout_width="#dimen/dp_45"
android:layout_height="#dimen/dp_45"
android:layout_centerHorizontal="true"
android:src="#mipmap/language" />
</RelativeLayout>
<View
android:id="#+id/changeLangdivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/changeLang"
android:background="#color/light_black" />
<RelativeLayout
android:id="#+id/logout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/changeLangdivider"
android:paddingBottom="#dimen/dp_5"
android:paddingTop="#dimen/dp_5">
<TextView
android:id="#+id/logoutText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/logoutImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/dp_8"
android:text="#string/logout"
android:textColor="#color/dull_black"
android:textSize="#dimen/sp_18" />
<ImageView
android:id="#+id/logoutImage"
android:layout_width="#dimen/dp_45"
android:layout_height="#dimen/dp_45"
android:layout_centerHorizontal="true"
android:src="#mipmap/log_out" />
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
& the Layout app_bar_home.xml looks 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"
tools:context="com.team.activities.Home">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="ltr"
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:title="#string/app_name"
app:popupTheme="#style/AppTheme.PopupOverlay"
app:theme="#style/ToolBarStyle">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/search"
android:gravity="left"
android:text="#string/app_name"
android:textColor="#color/black"
android:textSize="#dimen/sp_22" />
<ImageView
android:id="#+id/searchHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/notificationLay"
android:src="#mipmap/search" />
<RelativeLayout
android:id="#+id/notificationLay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="#dimen/dp_5">
<ImageView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/dp_5"
android:src="#mipmap/notification" />
<ImageView
android:id="#+id/notify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/notification"
android:padding="#dimen/dp_5"
android:src="#drawable/counter_bg" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_home" />
</android.support.design.widget.CoordinatorLayout>
& content_home.xml in which you can define the things as per your requirement in the application.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/content_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.team.activities.Home"
tools:showIn="#layout/app_bar_home">
<RelativeLayout
android:id="#+id/fragment_space"
android:name="com.presence.fragments.HomeFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/bottom_lay" />
<LinearLayout
android:id="#+id/bottom_lay"
android:layout_width="match_parent"
android:layout_height="#dimen/dp_50"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="#color/colorPrimary"
android:layoutDirection="ltr"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/tab_create"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/image_create"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/text_create"
android:layout_centerHorizontal="true"
android:src="#mipmap/create" />
<TextView
android:id="#+id/text_create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="#string/create"
android:textColor="#color/white"
android:textSize="#dimen/sp_10" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/tab_received"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/image_received"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/text_received"
android:layout_centerHorizontal="true"
android:src="#mipmap/recived" />
<TextView
android:id="#+id/text_received"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="#string/received"
android:textColor="#color/white"
android:textSize="#dimen/sp_10" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/tab_sent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/image_sent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/text_sent"
android:layout_centerHorizontal="true"
android:src="#mipmap/sent" />
<TextView
android:id="#+id/text_sent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="#string/sent"
android:textColor="#color/white"
android:textSize="#dimen/sp_10" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/tab_website"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/image_website"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/text_travel"
android:layout_centerHorizontal="true"
android:src="#mipmap/web" />
<TextView
android:id="#+id/text_travel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="#string/booking"
android:textColor="#color/white"
android:textSize="#dimen/sp_10" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
Try this hope it helps you.
I've got a problem with Expandable Layout (https://android-arsenal.com/details/1/2456).
When the app starts, the fragment is inserted in #id(flContent), ExpandableRelativeLayout is collapsed (because of app:ael_expanded="false") and I can expand and collapse this with a click on #id/cerca_button_advanced.
When, with the menu in NavigationView, I load another fragment and then again the first one, the ExpandableRelativeLayout still expanded.
Why does it still expanded, even if app:ael_expanded="false"? I hope someone can help me...
This is the activity_main.xml
<!-- This DrawerLayout has two children at the root -->
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- This LinearLayout represents the contents of the screen -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The ActionBar displayed at the top -->
<include
layout="#layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- The main content view where fragments are loaded -->
<FrameLayout
android:id="#+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<!-- The navigation drawer that comes from the left -->
<!-- Note that `android:layout_gravity` needs to be set to 'start' -->
<android.support.design.widget.NavigationView
android:id="#+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/white"
app:headerLayout="#layout/nav_header"
app:menu="#menu/drawer_view"/>
</android.support.v4.widget.DrawerLayout>
This is the fragment.xml inserted in #id/flContent
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
card_view:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TableLayout
android:id="#+id/cerca_tabella"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_nome"
android:text="#string/cerca_descrizione_nome"/>
<EditText
android:id="#+id/cerca_input_nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:inputType="textNoSuggestions|textCapSentences|text"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_via"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_via"
android:text="#string/cerca_descrizione_indirizzo"/>
<EditText
android:id="#+id/cerca_input_via"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:inputType="textNoSuggestions|text|textPostalAddress"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_citta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_citta"
android:text="#string/cerca_descrizione_citta"/>
<Spinner
android:id="#+id/cerca_spinner_citta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:entries="#array/cerca_citta"/>
</TableRow>
</TableLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<RelativeLayout
android:id="#+id/cerca_button_advanced"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="#+id/cerca_button_advance_logo"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentStart="true"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:background="#drawable/triangolo"
/>
<TextView
android:id="#+id/cerca_button_advance_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/cerca_button_advance_logo"
android:layout_toEndOf="#+id/cerca_button_advance_logo"
android:text="Advanced"
/>
</RelativeLayout>
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/cerca_button_advanced"
app:ael_duration="500"
app:ael_expanded="false"
app:ael_interpolator="decelerate"
app:ael_orientation="vertical">
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Switch 1"/>
<Switch
android:id="#+id/switch2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/switch1"
android:text="New Switch 2"/>
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<my.AdapterLinearLayout
android:id="#+id/cerca_linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"/>
</LinearLayout>
</ScrollView>
After trying many times I didn't figure out how to solve my problem. In my layout I have a navigation drawer with an appbar, inside it there's a Cardview with Relative layout. Here is a screen in my preview while coding xml in layout :
When i launch the app on emulator or the phone, I have this :
My Cardview appears over Appbar. Full layout code :
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/darker_gray"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:theme="#style/AppTheme.NoActionBar"
tools:context=".activities.display.MainActivity"
tools:openDrawer="">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="70dp"
app:cardBackgroundColor="#80FFFFFF"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="#+id/newresearch_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Rechercher"
android:textColor="#424242"
android:textSize="18sp"
android:textStyle="bold" />
<EditText
android:id="#+id/edit1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/newresearch_title"
android:layout_margin="5dp"
android:background="#drawable/custom_edittext"
android:hint="Prix min"
android:inputType="number"
android:padding="5dp"
android:textColor="#android:color/black" />
<EditText
android:id="#+id/edit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/edit1"
android:layout_margin="5dp"
android:background="#drawable/custom_edittext"
android:hint="Prix max"
android:inputType="number"
android:padding="5dp"
android:textColor="#android:color/black" />
<Button
android:id="#+id/bouton_de_recherche"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="#+id/edit2"
android:layout_centerHorizontal="true"
android:layout_marginEnd="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="25dp"
android:background="#drawable/custom_button"
android:text="Rechercher"
android:textColor="#424242"
android:textSize="12sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<include
layout="#layout/navdraw_appbar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/navdraw_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Thanks for the help !
EDIT: Added code of navdraw_appbar below
<?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"
tools:context=".activities.display.MainActivity">
<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/content_main" />
</android.support.design.widget.CoordinatorLayout>
Try this
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/darker_gray"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:theme="#style/AppTheme.NoActionBar"
tools:context=".activities.display.MainActivity"
tools:openDrawer="">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<include
layout="#layout/navdraw_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="#+id/rltv_allcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="70dp"
app:cardBackgroundColor="#80FFFFFF"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="#+id/newresearch_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Rechercher"
android:textColor="#424242"
android:textSize="18sp"
android:textStyle="bold" />
<EditText
android:id="#+id/edit1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/newresearch_title"
android:layout_margin="5dp"
android:background="#drawable/custom_edittext"
android:hint="Prix min"
android:inputType="number"
android:padding="5dp"
android:textColor="#android:color/black" />
<EditText
android:id="#+id/edit2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/edit1"
android:layout_margin="5dp"
android:background="#drawable/custom_edittext"
android:hint="Prix max"
android:inputType="number"
android:padding="5dp"
android:textColor="#android:color/black" />
<Button
android:id="#+id/bouton_de_recherche"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="#+id/edit2"
android:layout_centerHorizontal="true"
android:layout_marginEnd="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="25dp"
android:background="#drawable/custom_button"
android:text="Rechercher"
android:textColor="#424242"
android:textSize="12sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/navdraw_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Hope this will help you.
I had a similar problem recently. Assuming that your activity extends AppCompatActivity, have you set the toolbar in your activity?
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
I have an Activity which has a layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
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:minHeight="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="#+id/toolbar_title"
style="#android:style/TextAppearance.Large"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<ImageView
android:id="#+id/img_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginRight="20dp"
android:src="#mipmap/ic_filter" />
</android.support.v7.widget.Toolbar>
<FrameLayout
android:id="#+id/dashboard_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/lst_tourist_places"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:choiceMode="singleChoice"
android:smoothScrollbar="true"
android:divider="#android:color/transparent"
android:dividerHeight="10dp"
android:scrollbars="none"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/filter_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#android:color/white"
android:orientation="vertical">
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/container_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
android:minHeight="?attr/actionBarSize"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="#+id/txt_filter"
style="#android:style/TextAppearance.Large"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="#string/filter"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<TextView
android:id="#+id/txt_categories"
style="#android:style/TextAppearance.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="#string/categories"
android:textColor="#color/gray_categories" />
<RadioGroup
android:id="#+id/filter_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp">
<RadioButton
android:id="#+id/rb_historical_places"
style="#android:style/TextAppearance.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:button="#drawable/radio_btn"
android:checked="false"
android:paddingLeft="10dp"
android:textColor="#color/gray_categories" />
<RadioButton
android:id="#+id/rb_parks_gardens"
style="#android:style/TextAppearance.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:button="#drawable/radio_btn"
android:checked="false"
android:paddingLeft="10dp"
android:textColor="#color/gray_categories" />
<RadioButton
android:id="#+id/rb_religious_places"
style="#android:style/TextAppearance.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:button="#drawable/radio_btn"
android:checked="false"
android:paddingLeft="10dp"
android:textColor="#color/gray_categories" />
<RadioButton
android:id="#+id/rb_show_all"
style="#android:style/TextAppearance.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:button="#drawable/radio_btn"
android:checked="true"
android:paddingLeft="10dp"
android:textColor="#color/gray_categories" />
</RadioGroup>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
In my Activity I want to Programmatically remove the filter_ll i.e., the side drawer and make it a normal activity based on the Intent Extra.
Easy, hide the button which is used to access it. Also, add this,
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
where mDrawerLayout is your ActionBarDrawerToggle object in your activity. If you are doing this in a fragment, just add the above code with activity's reference like,
mActivity.mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
The FAB seems to overlap the toolbar at the top of the screen, whereas I want it at the bottom right of the screen.
If I modify the layout_height of the app_bar_main.xml element (contains toolbar and button) to "match_parent" instead of "wrap_content", the button gets correctly placed but then the fragment which should be there gets pushed off the screen/is not placed.
Issue seems to be with the structure of the xml files but I am not sure how to fix it.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/main_action_bar"
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="#+id/main_container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/colorPrimaryDark"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:itemIconTint="#FFF"
app:itemTextColor="#FFF"
app:menu="#menu/loggedout_main_drawer" />
</android.support.v4.widget.DrawerLayout>
app_bar_main.xml
<?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"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
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/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:shape="rectangle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:paddingBottom="30dip"
android:layout_margin="#dimen/fab_margin"
android:clickable="true"
app:borderWidth="0dp"
android:src="#drawable/ic_add_white_24px" />
</android.support.design.widget.CoordinatorLayout>
activity_login.xml (Layout of fragment that is placed in main_container)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".LoginFragment"
android:layout_below="#+id/main_action_bar"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Login."
android:id="#+id/login_title_text"
android:layout_alignParentTop="true"
android:textSize="40sp"
android:layout_marginBottom="70dp"
android:layout_marginTop="100dp"
android:fontFamily="sans-serif-light"
android:textColor="#color/colorAlt"
android:layout_centerHorizontal="true" />
<!-- E-mail section -->
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:hint="E-mail address"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:ems="10"
android:id="#+id/login_emailField"
android:layout_below="#+id/login_title_text" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/register_email_icon"
android:layout_alignBottom="#id/login_emailField"
android:layout_marginLeft="15dp"
android:layout_marginBottom="10dp"/>
<!-- Password section -->
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:layout_marginTop="10dp"
android:hint="Password"
android:layout_below="#id/login_emailField"
android:id="#+id/login_passwordField"
android:layout_marginLeft="50dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="25dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/register_password_icon"
android:layout_alignBottom="#id/login_passwordField"
android:layout_marginLeft="15dp"
android:layout_marginBottom="10dp"/>
<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:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/login_login_button"
android:layout_gravity="center_vertical"
android:layout_below="#+id/login_passwordField"
android:layout_marginBottom="29dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
card_view:cardBackgroundColor="#E91E63"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="6dp">
<TextView
android:id="#+id/material_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="13dp"
android:paddingBottom="13dp"
android:layout_gravity="center_horizontal"
android:textColor="#FFF"
android:textSize="19sp"
android:fontFamily="sans-serif-medium"
android:text="Login" />
</android.support.v7.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Forgotten your username or password?"
android:layout_below="#id/login_login_button"
android:gravity="center"
android:layout_centerHorizontal="true"
android:id="#+id/login_footer_text"
android:layout_marginTop="20dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Tap here"
android:textColor="#000000"
android:layout_below="#id/login_footer_text"
android:gravity="center"
android:layout_centerHorizontal="true"
android:id="#+id/loginForgottenTapText"
android:layout_marginTop="10dp"/>
</RelativeLayout>
</ScrollView>
Thanks for any help in advance.