I successfully created the Sliding up panel in my first screen of app(music player),also i have a navigation drawer. Now the problem is this sliding up panel is only available on the first screen. I want it for all my screens (downloads, etc).I want the same way as in apps like Gaana and Google Play Music.
I refered this while creating sliding up panel
https://www.numetriclabz.com/implementation-of-sliding-up-panel-using-androidslidinguppanel-in-android-tutorial/
please help,Thanks!
Explaination:-
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/frag_product_list_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:gravity="bottom"
android:orientation="vertical"
app:umanoDragView="#+id/dragView"
app:umanoOverlay="true"
app:umanoPanelHeight="0dp"
app:umanoParallaxOffset="0dp"
app:umanoShadowHeight="#dimen/2dp">
<!-- Main content, Use this container to transact fragments -->
<FrameLayout
android:id="#+id/dragView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Sliding content -->
<LinearLayout
android:id="#+id/dragView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#android:color/white"
android:clickable="true"
android:focusable="false"
android:orientation="vertical">
<!-- content of sliding panel goes here -->
</LinearLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
If you're wondering about Fragment, follow this link -
How to do FragmentTransaction
Official guide
Happy coding!
Related
I am planning to use Sliding Panel Layout for one of my App. In master pane there is an image and in detail pane a list view is used. Issue is when detail pane (Listview) is opened (left to right) master pane (image) is also moved towards left. I need master pane should not be moved when sliding panel is opened. You my refer attached screen to understand this.
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/SlidingPanel"
android:layout_width="match_parent"
android:layoutDirection="rtl"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="right">
<ListView
android:id="#+id/MenuList"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#101010"
android:orientation="vertical" >
<ImageView
android:id="#+id/image_robot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/android_robot" />
</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>
Firstly sliding of a menu is not depend on XML file. You should check your Class of Main activity. As reference visit here http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
I want to use SurfeceView to make simple painting app like MS Paint.
I created main activity with navigation drawer as toolbox for painting tools.
I assumed that user I can operate on many surfaces (pages) so I made for each page separate fragment with SurfaceView inside.
In main activity I made customized button to open drawer.
In fragment I set mSurfaceView.setZOrderOnTop(true) for SurfaveView and in SurfaceView mHolder.setFormat(PixelFormat.TRANSLUCENT)
Fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<it.controls.PaintPageLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="#e0aa66cc"
android:visibility="visible">
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Sv"
android:textSize="12sp"
android:padding="0dp"
android:background="#ffff4444"
android:textColor="#android:color/black"
android:minWidth="40dp"
android:id="#+id/surface_fragment_debug_save" />
<TextView
android:id="#+id/surface_fragment_debug_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end"
android:text="debug_info"
android:textColor="#android:color/white"
android:background="#android:color/transparent"
android:visibility="visible"
android:layout_toEndOf="#+id/surface_fragment_debug_save" />
</RelativeLayout>
<it.controls.PaintSurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/surface_fragment_surface"
/>
Main layout is almost standard template generated from Android Studio, expect that my app is full screen (doesn't have Toolbar)
<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">
<!-- The main content view -->
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_coordinate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<!-- button to show left menu -->
<android.support.v7.widget.AppCompatImageButton
android:id="#+id/toolbox_toggle_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/toolbox_show_margin"
android:layout_marginLeft="#dimen/toolbox_show_margin"
android:contentDescription="#string/menu_show_hide_menu"
android:src="#drawable/ic_menu_black_48dp"
android:minWidth="#dimen/toolbox_show_button_size"
android:minHeight="#dimen/toolbox_show_button_size"
android:scaleType="fitCenter"
android:background="#drawable/toolbox_new_page_button_border"
/>
</android.support.design.widget.CoordinatorLayout>
<!-- The navigation drawer -->
<FrameLayout
android:id="#+id/menu_container"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="horizontal"
android:layout_gravity="start"
tools:ignore="UselessParent">
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
When I coded that I made simple drawing mechanism to draw path in SurfaceView and there is a problem.
My problem is that after I draw path I would like to change color so I must open toolbox (drawer). After I open drawer I saw that path is painted ON drawer as on screen below.
What I made wrong? How to hide SurfaceView behind drawer?
Your app has two distinct layers: the View UI layer, and the SurfaceView Surface layer. One of them is entirely on top of the other. You can't put one partially under the other. You put the SurfaceView Surface on top, so it's in front of all of your Views.
You might be better off with a custom View, rather than a SurfaceView. It'll mix in with your other Views, and for Canvas rendering it can be more efficient because it'll take advantage of hardware-accelerated rendering.
Hi I am trying to implement a sliding drawer overlay in my android app. I have taken reference from this link:
https://github.com/SimonVT/android-menudrawer
and implemented a menu drawer in my activity. So my activity has 2 fragments in a viewPager with a TitlePageIndicator. When I click on a button in the fragment, the menu drawer opens. Currently the drawer overlays the titlePageIndicator as well. I would like to know to implement a menu drawer which opens/overlays below the title of the viewPager. Or is something like that not possible? Thanks for the help!
you can use below xml, you should define a layout below of your titlebar and set that for it:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.mhp.chek"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- main layout -->
<LinearLayout
android:id="#+id/base_layout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_gravity="end"
android:orientation="vertical" >
<!-- for example your **viewpager** can define here -->
</LinearLayout>
<!-- drawer layout-->
<LinearLayout
android:id="#+id/drawer"
android:layout_width="300dp"
android:layout_height="fill_parent"
android:layout_gravity="end"
android:orientation="vertical" >
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
note that you need support library for this one.
I want to implement an Android app which measures someone's performances in sport activities.
The problem which I have is that I must implement a sliding menu from the left side of the screen, where one can change the account on which the performances must be registered.
I don't know how to make the part which is show in this picture.
One can add a new user by clicking on add new user button, can edit the account by clicking on the pen, and switch to other account by clicking on it when it is inactive.
I've searched for info about how to do this but I didn't find anything related to this.
This is how my app must look:
Does anyone have an idea about how to do this or something similar to my issue?
You have to Go for Sliding menu lib.
you can use android DrawerLayout.
Please take look.
There is Suggestion of design for NavigationDrawer..............
This could help you to Create Layout like that...
First Create Navigation Drawer form Here : Creating a Navigation Drawer
and then change some code in Drawelayout.xml(which contains nav. drawer)
navDrawer.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/com.equest.cwely.act"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<!-- The navigation drawer -->
<LinearLayout
android:id="#+id/drawer"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/actionbar_bg"
android:orientation="vertical" >
<include
android:id="#+id/nav_list_header"
layout="#layout/nav_profile" />
<ListView
android:id="#+id/drawer_list"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="10dp"
android:choiceMode="singleChoice"
android:divider="#55ffffff"
android:dividerHeight="0.5dp"
android:listSelector="#drawable/list_selector" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Here,
<include/> : I have created one layout and added it into navDrawerLayout file...
<ListView/> : second Layout...........
When I put ScrollView into the content of a DrawerLayout, I am nolonger able to open the drawer by swiping from the side.
Activity layout:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The menu_main content view -->
<FrameLayout
android:id="#android:id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<!-- The navigation drawer -->
<ListView
android:name="com.gumtree.androidapp.DrawerFragment"
android:id="#+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>
In Activity's onCreate I add a fragment which has following layout:
<ScrollView
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">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_height="160dp"
android:layout_width="match_parent"/>
<TextView
android:id="#+id/headline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/headline_text_size"
android:padding="#dimen/detail_text_padding"
android:textIsSelectable="false"/>
<TextView
android:id="#+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/description_text_size"
android:padding="#dimen/detail_text_padding"
android:textIsSelectable="false"/>
</LinearLayout>
</ScrollView>
Without the ScrollView everything works fine and I am able to open the drawer by swiping from the side. However when I add the ScrollView, it stops working.
The problem here was silly named ID of FrameLayout used as content container of DrawerLayout. I used system ID (android.R.id.content) which caused that the content fragment was put on the top of all other views - even the drawer.
It also caused fragment's layout to overlap the drawer and - related to this question - blocked the drawer from receiving touch events. The touch events were taken by fragment's ScrollView.
Conclusion: DO NOT USE SYSTEM IDs (android.R.*) WHERE IT IS NOT NEEDED.
I just wanted it to look nice and clean.. Silly me :)