how to center android Textview element at bottom of the screen - android

I have the android xml layout using DroidDraw :
link : https://docs.google.com/document/d/1L3QJVwI9Znmeu1yANJXhDcZGFR70587d4oznu0hrZCw/edit?usp=sharing0
I need to bottom align the last Textview (Yellow one as indicated in the print screen).
i.e.
I need this :

Try using
android:alignParentBottom="true"
If I see correctly that the parent ViewGroup of your TextView is a RelativeLayout

Set the parent relative layout property to:
android:layout_gravity = "bottom | left"

In Relative layout use:
android:alignParentBottom="true"
and In Linear layout use:
android:layout_weight="1.0"
android:gravity="bottom|right"

This post did the trick.
stackOverflow link
I needed to implement layout_weight on my layouts. Basically defining weights for header, content and footer

Related

Why can't I put a aligned right TextView inside a TableView?

In my layout, I really need to the TableView be the root view, but inside it I need very much a single TextView to be aligned to the right border of the screen, but I keep receiving the warning: Invalid layout param in a TableLayout: layout_alignParentRight activity_main.xml
What should I do to have a aligned textview inside a TableView?
You can use gravity in TableLayout, Try to set android:gravity="right" to TextView
android:layout_alignParentRight="true" works fine for me if it's not working then check your parent try fill_parent on the parent or try moving it from it's parent layout hope this helps

How to set a TextView at the bottom of the screen

I have this layout:
It was a bit tricky to put ListView inside ScrollView, but it worked.
When the list is large and the scroll appears when scrolling .. everything up, including the form. That is ok!
Now I would like to put a TextView fixed at the bottom of the screen. As a total
Tried to wrap everything with a RelativeLayout put layout_weight = "1" in ScrollView. Worked. But when the keyboard appears, rises along the TextView and do not want it.
How do I set a TextView at the bottom of the screen, without moving when the keyboard appears?
Put everything in a relative layout. Add the TextView to the relative layout, set layout_alignParentBottom on TextView. Then on the ScrollView set layout_above referencing the TextView.
Follow the design hierarchy:
<LinearLayout.....>
<ScrollView>
<You Old Views/>
</ScrollView
<TextView> .. </TextView>
</LinearLayout>

Android top left button

I want to make an about button in the top left. I tried:
android:layout_gravity:"top|left"
but it doesn't work , I searched and all what I found was using RelativeLayout and if I use that I'll have to make all my layout from beginning and it's not that good like the linear layout.
Couldn't post the code here. So this is my code on pastebin
http://pastebin.com/5EjgyB0K
Here you have given android:layout_gravity="center" to the Linear Layout so it is going to set gravity of the layout and as center and your About Button is child of layout its to going to set in center and you have given Margin_top also.Try to remove gravity amd Margin_top and you can see the result, the button will be top|left of the screen.

Removing the margin from bottom in android Relativelayout

Hello i have used a Relativelayout in android using XML but when i see image in graphical layout there is small margin left at bottom in different screensizes.How to remove that margin.I also used a ScrollView in layout.
I think you have to set bottom margin in negative
like
android:layout_marginBottom="-10dip"
Check whether you have used padding for your layout,
Better post your layout file and/or screenshot.

How to prevent TextView from resizing its container

Take a look at my layout
http://pastebin.com/6tQVm3Rk
My problem is that the textviews (named header1 to 5) are resizing its containers when a certain amount of letters are written into it, although there is still some space left.
What changes do I have to make that the layout stays in its original state independent from the amount of text located in the headers?
This might be because of this attribute.
android:inputType="textMultiLine"
If you want your textview to have only one line you can use android:singleline="true"
Add the attribute
android:maxLength="2"
to the textview. This way you can limit the number of characters.
I think its better to use Relative layout instead Linear layout in the XML so that objects in Relative layout are easy to manage dynamically, all you need to do is that put all those text views in the Relative layout and set these parameters:
layout align left:
layout align right:
And other solution which is not appropriate is that fix the size of text view then it will not expand.
And please see the Documentation for further details of Relative Layout.
Set the width and heigth of your textview to a fixed amount of dp. This will prevent the textview from streching beyond the width and height you declared. Like this:
android:layout_width="50dp"
android:layout_heigth="50dp"
For me the solution was to use
android:layout_width="0dp"
together with
android:maxLines="1"

Categories

Resources