How to set up footer in in a android fragment? - android

I want to set a footer in android fragment. I am using appcomat for action bar and would like to have a bar simialr to action bar with as footer.
Footer will display some information as text .It wont have any clickable buttons.
I have create a mockup of footer as shown below.This will then contain some text.
Note the color of footer should be same as action bar.
Also the UI looks very ugly.How can i make it better?

answering my own question : I found the following way better.
Use nested layouts
Android: 2 relative layout divided in half screen

Related

Is it possible to display a bar on top of BottomSheet in Android

I am using a BottomSheet in my application, which contain some list items, and I am also using a Tab bar view in my whole application (at bottom of screen).
Is it possible and how can I display my that Tab Bar still in bottom of screen, and BottomSheet should also appear (on defined offset), but below my Tab Bar.
How can I adjust and arrange these layouts?
Please show Below link. Also you can add multiple tab bar in bottom layout.
https://material.io/design/components/bottom-navigation.html

how to put text on floating action bar (fab) in android, let the action bar be cart and text be number of items

Screenshot from Bigbasket App
I have achieved same thing by custom layout. But is there way we can put text above fab provided by android.
The FloatingActionButton extends ImageButton, which does not support text.
If you want to achieve the effect in your link using the native FloatingActionButton, you'll need to create a different icon for each digit you want to represent.
Add a textview and make it above the floating action button at centre using relative layout params and elevation attribute. You need to check for click of both I guess.
You can see this answer for elevation attribute.

How to position the elements in a custom action bar layout in Android?

I need to develop a custom layout for the action bar in Android.
I'm now stuck because I have no clue how to calculate the available space for my custom layout.
In the image, the red part is my custom layout, the blue part is the space occupied by the action buttons.
Clearly I need to know/calculate the size of the red part to be able to correctly position the elements in my custom action bar (for example center the title in the window or make sure not to overflow in the blue part).
How can I achieve this?
I couldn't find useful examples or a clear API in the Android documentation.
I think that anyone using the custom action bar layout must be facing this kind of problem, I'm a bit confused.
Or am I supposed not to use action buttons in this case? Perhaps I'm supposed to replicate the action buttons by myself?
Thanks in advance
Try using ToolBar instead of ActionBar. It will give you a lot more control over ActionBar elements than ActionBar.
Here is a simple tutorial about how to replace ActionBar with ToolBar and how you can customise it.
Material ToolBar
Possibilities are endless with ToolBar but my recommendation is to don't overdo anything.
As per my suggestion try to use the entire action bar by your custom layout. So that you can arrange all the things use it as a fragment inside a framelayout for all your screens so that the code can be reused for all your layouts.

Custom title bar vs. layout with header

I recently thought of adding a custom title bar to my app (with "find me" and home button and such) and then I thought what is the reason of using a custom title bar at top instead of just a normal layout and using it as an include tag at the top of my XML's
What are the pros and cons of each? Is there realy a difference?
EDIT: one difference ive found so far is that the custom title bar has a shadows automaticly
For having back and home button titlebar, you should define normal layout for the same. Because it is easy to implement as compared to customized the native title bar. And we can create normal layout as we wants with any color/height/width/image backround/etc.
I suggest you to go with defining normal layout for the title bar instead of customizing the native title bar.
You can extend LinearLayout to create a new layout with your title bar. The advantage is you can then customise the title bar for different activities that use it. Some may not want to display the find button for instance.
If you use include in XML you don't have the same flexibility.
I would create a custom layout with the title bar.

Custom Component in android

I have created custom component with a Button Bar on the Bottom of
the screen and a Title and status bar on the top of the screen. I want
to include this custom component in every one of my Activities. Now,
in a any given activity, how do I go about adding content on the
screen (say a button in the middle of the screen) in a addition to my
custom component thats ever present?
How about adding a base layout with can contain the header and footer that you use everywhere and then have a stub in the middle that you can inflate with whatever you like?
I think that will solve your problem.
You can read about ViewStub here:
http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-with.html

Categories

Resources