Is there any way to set the navigation drawer as visible always?.
So that the user knows that there is something on the right/left.
Like what you see in Hangouts app.
I know hangouts uses SlidePaneLayout, But anyone knows how to achieve this using Navigation Drawer?.
Got It!!.. Simplicity at its best. No libraries, No complicated codes. Use SimplePaneLayout.
Just set the android:layout_marginLeft to a suitable value. :) Awesome :)
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/slidingpanelayout">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CCC"
android:orientation="horizontal"
android:id="#+id/fragment_firstpane"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="horizontal"
android:layout_marginLeft="40dp"
android:id="#+id/fragment_secondpane"/>
</android.support.v4.widget.SlidingPaneLayout>
Related
Can any one please tell me, how to disable segmentedcontrol in android.
I have been using Foursquared library.
The link for library is given below.
You can do one thing for that.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<SegmentedButton
android:id="#+id/login_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
/>
<Layout
android:id="#+id/transperent_fragment"
android:name="com.test.transperentFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/body_texture"
android:alpha="0.2"
android:clickable="true"/>
</RelativeLayout>
Hope this helps you..:)
I'm looking for a custom TabLayout. The icon of the Tab in the middle needs a margin to overlay the content. Please check out the image below.
What I've tried so far
Tab.setCustomView() with a margin. That doesn't overlay the content though.
Looked for TabLayout libraries that give such flexibility. Didn't find anything that fits my need.
Re-invent the wheel?
Since I don't need any complicated scrolling functionality, I could develop my own TabLayout with a couple ViewGroups,TextView and ImageView. Before I have to do that:
Do you know of any library that would do that?
How would you approach it?
Any help would be greatly appreciated!
I achieved that by the combination of a custom library and the floating action button.
The library: MagicIndicator on GitHub
I set the icon of the middle fragment to an empty icon and positioned the floating action button in the middle to overlay the TabLayout. It looks like this:
My activity 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/res-auto"
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=".MainActivity">
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginBottom="50dp"
app:layout_behavior="#string/appbar_scrolling_behavior" />
<net.lucode.hackware.magicindicator.MagicIndicator
android:id="#+id/magic_indicator"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/light_gray"
android:layout_gravity="bottom" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|bottom"
android:layout_margin="10dp"
app:srcCompat="#drawable/add_icon"
app:backgroundTint="#color/colorPrimary"/>
</android.support.design.widget.CoordinatorLayout>
I am learning Android these days, and I am having some trouble implementing something. When I click on the image icon, I want a menu to appear from below. The screenshot is as below. (Sorry it's in chinese....)
There's awesome library on github to get your task done.
All you need to do is setup your layout in two part as describe in below code
part 1: Your main activity(main frame)
part 2: bottom Panel which will be shown when user swipe/click on button.
You must check how to set "anchor point true" in library document.
<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="#+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoDragView="#+id/dragView"
sothree:umanoPanelHeight="68dp"
sothree:umanoParalaxOffset="10dp">
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<RelativeLayout
android:id="#+id/panel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--This is bottom layout.-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00FF00"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
<Button
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000FF"
android:text="Button 1" />
</LinearLayout>
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
I think what you are trying to do here is to replicate the action sheet of iOS in android. There is this library which does exactly what you are looking for, https://github.com/baoyongzhang/android-ActionSheet . You can either have it as it as it is provided by author or you can clone it and suit your need accordingly. I would prefer if you could clone it as a module in your app that way you have limitless way to re-design it. If you need help on that let us know
You can simply follow the below link , it will implement what u need :
http://trickyandroid.com/fragments-translate-animation/
This will be done through Transition Fragment Animation .
I have a SlidingPaneLayout in my application and I want it to appear more or less like Hangouts does. I show a list of elements on the left and the detail on the right pane, overlapping when an element is selected.
This is what I see on my Galaxy Nexus, which is pretty what I meant to see:
Now, this is what I get on my old Galaxy S:
The code is pretty simple:
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/sliding_pane_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/list_pane"
android:name="com.towers.hotelsclickpoc.ResultsCardsFragment"
android:layout_width="400dp"
android:layout_height="match_parent"
android:layout_weight="40"
android:layout_gravity="left"></fragment>
<fragment
android:id="#+id/content_pane"
android:name="com.towers.hotelsclickpoc.DetailsFragment"
android:layout_width="450dp"
android:layout_height="match_parent"
android:layout_weight="45"
android:paddingLeft="16dp"
android:paddingRight="16dp"></fragment>
</android.support.v4.widget.SlidingPaneLayout>
How can I make the layout look pretty the same on the two devices? As you can see I tried adding some weights but didn't work.
Ok, it seems like I managed to get it fixed.
The inner part of SlidingPaneLayout now looks like this:
<fragment
android:id="#+id/list_pane"
android:name="com.towers.hotelsclickpoc.ResultsCardsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"></fragment>
<fragment
android:id="#+id/content_pane"
android:name="com.towers.hotelsclickpoc.DetailsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"></fragment>
it seems the layout_width="match_parent" on BOTH fragments did the trick.
I hope this will be helpful to others.
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>