android - TextView won't center vertically in parent -
my activity has single textview , trying text center vertically ends aligning bottom. tried changing several properties no luck. here have (android 2.3):
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/llflash" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="0dp" > <textview android:id="@+id/tvflash" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#ff0000" android:padding="0dp" android:textstyle="bold" android:includefontpadding="false" android:gravity="center_vertical" android:layout_centerinparent="true" /> </relativelayout>
edit: setting textsize in code , large value. if textsize increased width of screen (in landscape mode), appears aligned bottom of screen. however, if use normal textsize (like 20sp), appear centered. tells me when increase textsize large, appears android increasing hidden inside padding (even though did set includefontpadding false).
looks fine me but,
why don't use;
android:layout_centervertical="true"
instead of
android:gravity="center_vertical" android:layout_centerinparent="true"
Comments
Post a Comment