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.
Related
I can not figure out for the life of me why and how to stop the Linear Layout from overlapping the navigation bar. I am familiar with Android Studio, just not version 2+.
This problem was never a thing and I have tried multiple searches and attempts to fix this. (Screenshot below).
Put this in your LinearLayout code in the content_main.xml file.
android:layout_width="match_parent"
android:layout_height="match_parent"
In your LinearLayout set padding top 50dp
android:paddingTop="50dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
You can change margin values depending on layout position.
I am trying to code a fixed button bar at the bottom of the page like it may be found on Instagram at the bottom of the screen.
Screenshot:
More similar images
The buttons at the bottom of the page are fixed there. I tried to put a new relative layout with a background colour with 5 image buttons, but when I change the screen size some buttons disappears.
I tried a split action bar, but it is not what I am after.
Any idea?
Thanks a lot!
If you want each button to take up the same amount of space then just use a LinearLayout instead of RelativeLayout. You can then use the layout_weight param for each. Roughly...
<LinearLayout
...>
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
.../>
<ImageButton
// just like above />
</LinearLayout>
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.
Good day (or evening, or night)
I'm developing an app for android and I'm very curious about one thing. I have an activity, where user chats with another, like "im" chat. There are an EditText on the bottom and some kind of actionbar on the top. What I need is when user enters a message and the software keyboard is on screen, my activity should move up, but the actionbar should still be "glued" to the top of the screen, because it has some valuable controls on it.
Again, that's not an ActionBar, but just a 48dp height layout in a parent vertical linear layout. So I need to know is there an easy way to prevent it from moving to the top, when the layout moves off the screen.
I tried to put everything in a FrameLayout and put this bar on top of it, but on keyboard opens it goes off the screen too...
On you Activity at AndroidManifest you should put this: android:windowSoftInputMode="adjustResize"
Use something like this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.myapp.MyActionBar
android:layout_width="match_parent"
android:layout_height="48dp"/>
<LinearLayout
android:id="#+id/mylayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1dp"/>
<!-- Add your edittext and button -->
</LinearLayout>
This will make sure the actionbar and edittext + button are allways on screen, and the mylayout takes up the rest of the screen. When your keyboard is shown, the mylayout will shrink.
Try adding android:windowSoftInputMode="adjustResize" to your activity in the manifest. This tells Android to completely resize your layout when the keyboard comes up, rather than pan it. Note that if there isn't enough room for the entire layout this still won't work. But you ought to be able to make it work if your top level layout is a RelativeLayout, with the edit text set to align bottom, the top bar to align top, and the middle section to fill_parent and be above the edit text and below the bar.
use a RelativeLayout as your base Layout and add android:layout_alignParentTop="true" to your action bar to keep it up
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/action_bar_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentTop="true" >
</LinearLayout>
<TextView
android:id="#+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
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