Can I have top sliding drawer in Android 2.1? - android

I simply want a sliding drawer from top in android which is applicable on Android 2.1. You can see an example of my need at this fiddle.
Is this possible using View Animations?
Note: The android misc widgets are useless to me, since they are far from usable in this case!

Why don't you just use a sliding drawer?
http://developer.android.com/reference/android/widget/SlidingDrawer.html
<SlidingDrawer
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:handle="#+id/handle"
android:content="#+id/content">
<ImageView
android:id="#id/handle"
android:layout_width="88dip"
android:layout_height="44dip" />
<GridView
android:id="#id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</SlidingDrawer>
Sliding Drawer Google Search

Related

Sliding Up Panel (Umano) facing some problems

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!

Slide Panel Layout - Why master pane move, when detail pane is opened ? how to stop it?

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/

placing viewpager with sliding tabs inside fragments as a nested format

What i am trying to do:
I am using a drawer where i have 10 fragments
Inside one of the fragment i am trying to add view pager with
sliding tabs(that has view pager indicator as per jake wharton)
What is happening:
When i tried to do this i get error as described here in one of my
other stackoverflow question
I am not able to bring the architecture described in the figure
below
Question::
Is placing view pager with sliding tabs not possible inside
fragments ?
If so are there any samples online ? (Jake wharton sample is done
with placing widgets in activity not fragments)
If any other way is available are there any open source library for
this
Note: i am aware nested way is not advised, but i need to get this architecture
Architecture i am trying to get it:
At first, you can try this sample from Google https://developer.android.com/samples/SlidingTabsBasic/project.html. It also contains the SlidingTabLayout class, try it, if you use something different.
This project is similar to your (has the same layout) except navigation drawer.
So, let's do the following things:
your main layout may look like this:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/content_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="#+id/drawer"
android:layout_width="#dimen/drawer_width"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#color/drawer_back"
android:gravity="left|center_vertical"
android:orientation="vertical">
<ListView
android:id="#+id/left_drawer"
android:layout_width="#dimen/drawer_width"
android:layout_height="0dip"
android:layout_gravity="left"
android:layout_weight="1"
android:background="#color/drawer_back"
android:choiceMode="singleChoice"
android:clipToPadding="false"
android:divider="#android:color/darker_gray"
android:dividerHeight="1dp" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
For fragment with sliding tabs use the following layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<yourpackage.slidinglayout.SlidingTabLayout
android:id="#+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"/>
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#drawable/toolbar_shadow" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:layout_marginTop="#dimen/small_padding"
android:background="#android:color/white"/>
</LinearLayout>
After that you should create a Fragments for your ViewPager and etc. but I think, you've already done it.
Fragment with sliding tabs and ViewPager - it's up to you.
On drawer item with sliding tabs clicked, simple use the FragmentTransaction:
mCurrentFragment = new SlidingTabsFragment();
mTransaction.replace(R.id.content_fragment, mCurrentFragment);
mTransaction.commit();

android sidebar navigation without using fragments

I want to create an activity that has sidebar on the left that is not changing between activity transitions (like split view in ios). It seems that I can do this with fragments but I need to add support for devices that is prior to HoneyComb.
I tried using a layout something like below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout android:layout_width="320dip"
android:layout_height="match_parent"
android:id="#+id/navLay"
>
<ListView
android:id="#+id/navList"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/contentLay"
><ListView
android:id="#+id/contentList"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</LinearLayout>
But the first list is also updated on activity transition. I want to note that the activity is the same activity except the right list's data source is different. So it would be pretty good if I could save state and content of the left navigation bar while navigating. Any help will be appreciated.
Take a look at Support Package which provides classes for backward compatibility, and includes Fragment class also.
It seems that I can do this with fragments but I need to add support for devices that is prior to HoneyComb.
You can use fragments and some new APIs on those devices. Just use support package.

Facebook-Notification like Pullable Screen

Can anybody point me to any public source where I can see how a pullable/draggable screen, like the one in the Facebook application for notifications, is implemented?
I have seen also this pattern in the application Öffi for DE/AT/CH/BE/UK.
Thanks for any help!
It's actually easier than you think - SlidingDrawer is part of the Android SDK. Just define the layouts to use for your drawer handle and your drawer content and you're done. From the docs:
<SlidingDrawer
android:id="#+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:handle="#+id/handle"
android:content="#+id/content">
<ImageView
android:id="#id/handle"
android:layout_width="88dip"
android:layout_height="44dip" />
<GridView
android:id="#id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</SlidingDrawer>

Categories

Resources