Position ActionBar in middle Android(Sherlock Implementation) - android

I have a custom action bar for which I have used Sherlock Implementation and I tend to find that the tab widget is placed at the top every time rather than in the middle.
I have tried the following in XML but it seems to set the action bar at the top :
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
></TabWidget>
I want it somewhere in the middle. I have provided with an example image below :
As you can clearly see that the action bar is located at the top which is not what I want. So,how do I place it after the Followers list. Any ideas ??

Is the parent View of you TabWidget a LinearLayout? If so, you may try your luck with a RelativeLayout.

Related

Navigation Drawer Notification Icon without Actionbar

In my application I do not want to use the actionbar or toolbar as my app is fairly simplistic and having one of those two would clutter my application. I know when using an actionbar with a navigation drawer there is an icon on the top left to show the drawer exists; however, I want a small notification icon in the middle of the screen to show that the drawer exists. Perhaps a clear arrow? Is this possible? I can not find any documentation on how I would approach doing this. Thank you.
Edit:
I do not want to use ANY type of action bar
Update 2
You can wrap your indicator in a RelativeLayout.
<RelativeLayout android:layout_width="match_parent"
android:layout_width="match_parent"/>
<MyIndicator
android:id="#+id/indicator"
android:layout_width="match_parent"
android:layout_width="match_parent"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"/>
<OtherView android:layout_width="match_parent"
android:layout_width="match_parent"/>
</RelativeLayout>
Update
Use FloatingActionButton from design library.
If you use a toolbar you can set a custom icon. Here is another post doing something like that: Custom icon in Android toolbar
You can use custom action bar in your app that can be customized according to your need.
Refer this link Custom Action Bar

How add custom view top of the android action bar

How to add a custom view top the android navigation bar like above image. when user click on the action bar need to push the main content down and add the custom layout top of the action bar.please how to accomplish this any one suggest a solution
Thanks
Rahul
An easy solution would be to use those views in the actual ActionBar like this: http://developer.android.com/guide/topics/ui/actionbar.html#ActionView. And then take all your layouts and put them inside a RelativeLayout and set their android:layout_below="" to a layout that corresponds to the ActionBar you want to use. So in a step by step way:
Create an action_bar.xml that has the items you want your actionbar to have (ImageViews or Buttons, w/e)
Include this layout in all the Layouts you will use (or in your main layout if you're using Fragments to display content).Like this:
<include layout="#layout/action_bar"
android:id="#+id/action_bar"
android: ... />
Make your Layout position itself below this layout (Using a FrameLayout for example)
<FrameLayout
android:id="#+id/content_frame"
android:layout_below="#+id/action_bar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
Include the ActionViews (Spinner and tabs) in the ActionBar like it's taught in the link up there.

Android Sliding Up View

I need to do a Sliding Up View wich should slide up from the bottom of the screen when I click a button. It has to show on the bottom of the screen and I need to slide/drag it to the center of the screen. The images below explain it better.
almost like the AndroidSlidingUpPanel from "umano" which you can find here:
The problem is that I want the first child (The content of my View - an image for example) to fill all the screen and also I want the second child(the actual bottom bar) to be showed when I click a button. The images below explain it better. If there is not possible to do this by changing the AndroidSlidingUpPanel, how can I do that? I have never worked with views like this. I would really appreciate any tip or help. Thank you very much.
To hide or show panel, you can use
showPanel()
method.
To hide it try this:
SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel);
slidingPanel.hidePanel();
To make it appe
SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout) findViewById(R.id.sliding_panel);
slidingPanel.showPanel();
This is available only in v 2.0 of AndroidSlidingUpPanel (https://github.com/umano/AndroidSlidingUpPanel). As I know, it's included in android support library v13 now, but not sure if there is latest version.
You can check this library for dragging content from all four edges of the screen https://github.com/SimonVT/android-menudrawer
You can make a custom layout inside this menu drawer to get your expected result.
You can do it with AndroidSlidingUpPanel, just set visibility:
android:visibility="GONE"
on the 2° child of the view (the panel) and use .showPane() and .hidePane() on SlidingUpPanelLayout to show/hide the panel when you click the button.
The following library do it as well
https://github.com/Paroca72/sc-widgets
Inside you will find a widget named ScSlidingPanel.
This widget work different from the other and can be use and customize very easily.
You put it inside a RelativeLayout give an alignment and it will open from that side.. Left, Right, Top and Bottom or mixed..
In your specific case your must align your panel at bottom of the container and it will sliding from the bottom.
<!-- Define the container -->
<RelativeLayout
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"
tools:context=".MainActivity">
<!-- Sliding from top -->
<scapps.com.library.ScSlidingPanel
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<!-- HERE THE YOUR CONTENT -->
<!-- or you can load by setLayout method -->
</scapps.com.library.ScSlidingPanel>
</RelativeLayout>
Another important property that you can use right for your case is the handle size.
You can define an handle and define the beavior of it.. as your image above you used a button.. you can unsing an image and setting setToggleOnTouch() to true for open/close the panel touching on handle.

How to create bottom menu like gmail android

I am not quite sure what kind of layout Gmail is using in Android.
I suppose they use a floating ViewGroup.
But for the menu on the top and bottom I really need somebody point me how to make that.
I suggest you to use the Sherlock ActionBar:
http://actionbarsherlock.com/
This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
In the sample app you can find the code to achieve what you are looking for under "Split Action Items". The idea is that you add actions from the menu as usual, but writting the following line in your manifest activity:
android:uiOptions="splitActionBarWhenNarrow"
You can create a menu which will sit on the bottom of a listview using the <RelativeLayout> tag like so
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#android:id/list"
android:listSelector="#android:color/transparent"
android:layout_above="#+id/footer" />
<include android:id="#+id/footer" android:layout_height="wrap_content"
layout="#layout/mymenu" android:layout_width="fill_parent"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true" >
</include>
</RelativeLayout>
mymenu will contain a linearlayout with something like a tablelayout with a few rows (which can be textviews, imageviews, etc.) The table will sit at the bottom of your screen and the listview will be in a frame which starts at the top of the screen and ends at the top of the menu (no overlap)
You could also do the same for the top of the screen by simply having the listview say layout_below="#+id/header" instead of layout_above"#+id/footer" (or do both!)
This is covered on android. You have to implement a "split action bar". Note that it works in potrait view and disappears when you switch to landscape.
Android Action Bar
It looks like a custom ActionBar implementation. If you put icons in a normal ActionBar and there is not enough space to display them, android creates a bottom bar on its own and display the icons there.
I had a similar application and I chose to put my own custom bar there instead of implementing ActionBar

titlebar bottom

i read this tutorial how to create a custom-titlebar.
http://www.anddev.org/view-layout-resource-problems-f27/my-own-titlebar-backbutton-like-on-the-iphone-t4591.html
works fine BUT:
is it possible to add this bar not as a titlebar on the top but on the bottom?
You can always create your own TextView and place it in an absolute position on a layout (see AbsoluteLayout here) but I would recommend against this as it breaks from the normal user interface standards and could be confusing to users. In addition if you have scrolling in your layout the positioning would become more complex. As far as I know there is no built-in way of moving the title bar.
Just an idea.
You can turn off the title bar and add something like title bar to the bottom of all your layouts:
<LinearLayout
android:orientation="vertical"
android:width="fill_parent"
android:height="fill_parent">
<LinearLayout
android:id="#+id/layout_container"
android:weight="1"
android:height="0dp"
android:width="fill_parent">
...
</LinearLayout>
<LinearLayout
androdi:id="#+id/titlebar"
android:height="wrap_content"
android:width="fill_parent">
...
</LinearLayout>
</LinearLayout>
But i've never seen a title bar at the bottom.

Categories

Resources