i'm trying to implement a menu which i want on the bottom outside of the screen. When i swipe up from the bottom edge of the screen i want it to appear there.
Furthermore i want a HorzizontalScrollView in there. Actually it should work like a Navigation Drawer on the side.
Here is the layout I already tried. I used the umano AndroidSlidingUpPanel:
<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:panelHeight="200dp"
sothree:shadowHeight="4dp"
sothree:overlay="true">
<TextView
android:text="Hier wird das pdf gezeigt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/file_scroll_view"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/file_scroll_view_linear_layout"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
The slide up works, but i don
t know how to position it outside of the screen and how to let it only slide up until it aligns the bottom edge.
Furthermore I want the ScrollView working. Before I tried with the SldingUpPanel it worked like charm but now its not scrollable.
Anyone got an idea or any hint how to solve this?
for nothing to be seen you have to:
slidePanel.setPanelHeight(0); // I couldn't find anything on XML for that
and for it to stop midway through:
slidePanel.expandPane(0.1f); // for example for 10% of screen.
Related
Hey I was wondering if it is possible to change the position of the scroll bar in Android RecyclerView. I would like to move the scroll bar closer to the right side of the display. If someone could just point me in the right direction with a link or something I would really appreciate that because currently I can't find anything on this.
Thanks!
I have only one workaround idea,
you can add to your main content layout only top and bottom padding (or margin).
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="4dp"
android:paddingBottom="4dp">
Then RecyclerView without defining styles, like this:
<android.support.v7.widget.RecyclerView
android:id="#+id/cardList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"/>
and if you use CardView or other element, you can add left and right borders to him, then scrollbar keep on right side and element is not until the edges:
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:layout_marginRight="6dp"
android:layout_marginEnd="6dp">
I am trying to make something like a slide down menu, but i also want it to act as a title bar.
I originally wanted to make the title bar be able to slide down and reveal a listView with clickable items. Unfortunately putting a layout in a title bar didn't work out to well.
Instead I decided to make a custom title bar and give it a size of 0,(I didn't want to use the flag FEATURE_NO_TITLE, since it removes the status bar as well)
So far i have something that slides down, but does not match the parent width. The layout of the textView that makes it slidable does not align to the left. I would like to figure out how to make the background a different colour, of the entire "sliding drawer"
i need help with:
match text view to parent width
Align text view to Left
Change colour of the panel that slides down
Thanks for any help
In my Main activity i am just setting the title to a custom title, and the content view to the following XML.
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/slidingDrawer"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:content="#+id/content"
android:gravity="center_horizontal"
android:handle="#+id/handle"
android:orientation="vertical"
android:rotation="180" >
<LinearLayout
android:id="#+id/handle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="180"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Pull Here"/>
</LinearLayout>
<ImageView
android:id="#+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:rotation="180"
android:src="#drawable/ic_launcher" />
I suggest you to try the SlidingMenu library. You can find it here
Looks like you are reinventing the wheel. There are many perfectly functional sliding-drawer libraries available. You can practically have a drawer slide from top, left, right or bottom and even have them in crazy awesome locations like in a listview row.
Have a look at the app - Libraries for Developers, which lists out every library along with demos & github links. Its better if you choose one and customize it to your needs.
When SlidePaneLayout is closed it covers the entire window,
I need to see the background when the slidePaneLayout is in closed state.
i.e., Covering layout should cover 80% and the background should be visible for the rest 20%.
Like you see in the Navigation Drawer,
I have tried all the tutorials and libraries, Is there any simple solutions like setting the layout_weight or layout_width?.
I tried it but it didn't work.
Could someone please help.
<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:background="#android:color/transparent"
android:windowBackground="#android:color/black"
android:id="#+id/sp" >
<!-- Left side pane. (Master) -->
<LinearLayout android:id="#+id/leftpane"
android:layout_width="250dp"
android:layout_height="match_parent"
android:background="#DFDEFF"
android:orientation="horizontal" >
</LinearLayout>
<!-- Right side page. (Slave) -->
<LinearLayout android:id="#+id/rightpane"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>
You should set the background one's layout_width to a suitable number.
The covering one's layout_width should not be '0dp'! Just be any number,so much as "match_parent".
The content panel always be set to "match_parent whatever you set.
the left panel and the right panel(the content panel) are not in the same plane.
I'm using animation in LinearLayout in order to show and hide right pane. The layout consist of two elements: a map and right panel. When panel hides map immediately changes its size and then animation appears. Its OK.
But when the panel is showing the map shrinks immediately too therefore black space is shown when panel slides and it looks ugly.
The markup as follows:
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:animateLayoutChanges="true">
<MapView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/map_view"
android:layout_above="#id/bottom_panel"
android:layout_weight="1"/>
<LinearLayout
android:id="#+id/right_panel"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:layout_weight="3">
<!-- Panel content -->
</LinearLayout>
</LinearLayout>
Here is the picture of what's going on during animation:
Can somebody help me with this? Thanks in advance!
Consider the Hotmail app for Android. When you check an e-mail item, three buttons appear at the bottom: [Mark Read] [Mark Unread] [Delete]
When you uncheck it, the buttons go away again.
What's the layout for this? I've tried this, but it yields scrolling problems at the bottom (can't see last item):
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/black" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#android:color/darker_gray"
android:orientation="horizontal"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="5dip" >
<Button
android:id="#+id/bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:text="#string/mark_read" />
</LinearLayout>
Then, I also need to show/hide this stuff?
Changing the visibility of bottom linearlayout will show/hide it. You'll need to give it an id and then
LinearLayout bottomLayout = (LinearLayout)findViewById(R.id.someId);
bottomLayout.setVisibility(View.GONE)// or View.VISIBLE
As for the scrolling problem, that occurs because the RelativeLayout overlays view components, so you can either show/hide the button overlaying the bottom of the ListView or change the Relativelayout to a LinearLayout so that the ListView ends before the button and change the visibility.
Though I'm not sure this will look very good when you suddenly show the button and the ListView has to resize itself.
Note on visibility
setVisibility(View.GONE);
will remove the view from the layout and other component may resize due to this. However using
setVisibility(View.INVISIBLE);
keeps the space the view took up in the layout and simply makes the view invisible and no resizing will occur.