Padding issue?
Update Sample of the issue:-
(Why is there a gap above the word "Late")
Update 2 Others gave reported similar issues here:- http://code.google.com/p/android/issues/detail?id=22493
So it seems that a textview doesn't reduce in size once it's been bigger. Any ideas for workarounds for this? setting the height explicitly causes the text to be cropped as it's lower than it should be.
I have a layout as follows:-
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="1dp"
android:orientation="vertical"
android:background="@color/Green">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/datetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/DateCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:textStyle="bold"
android:background="@color/Red" />
</LinearLayout>
and it is populated into a this GridView to form a calendar:-
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="7"
android:verticalSpacing="2dp"
android:horizontalSpacing="2dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
The adapter used to populate the gridview with the items changes the text size of @+id/DateCode to fit the text to the width of the available space. it then invalidates the textview and forces a re-layout (I know this works as the bottom of the textview does come up to the bottom of the resized text).
The top of the text within DateCode seems to start at least halfway down the TextView (which is clear as a red box. I don't understand why the area is not shrunk to fit the text in.
I assume it's a padding issue or something I don't understand, but it doesn't seem to be the font padding given how big it is.
Any ideas why the textview is positioning the text so far down, and not wrapping it into a much smaller space?
- Anthony