How to reduce text size in xml format?

I have 1-inch tall text, but the box with the image takes 1.5 inches, so a quarter of an inch above black and white lettering is a quarter of an inch. I want to reduce this 1/4 inch so that I can get 5 lines of text on my 6-inch screen instead of 4. I can move them closer to the android: lineSpacingMultiplier = ". 66", but it just moves the boxes closer together and 1 / 4 inches of black space covers the text of a nearby line. android: includeFontPadding = "false" does nothing. Negative padding does nothing. The insert in android: lineSpacingExtra = "- 50sp" also just has a black edge covering the adjacent line of text. I want to get rid of the field (in fact, only in most cases).

I tried every option that I can think of, including the obvious additions and the fields and additions discussed above, including zero and negative numbers. I cannot find a simple diagram showing what controls the space in the view over the actual text.

How to reduce this wasted space?

(my internet has been in the last 2 hours, so it took me a while to answer. Sorry)

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/textTimer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.01"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />


<TextView
    android:id="@+id/textTimeToLine"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimer"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.02"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToKill"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToLine"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToPin"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToKill"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

<TextView
    android:id="@+id/textTimeToCB"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textTimeToPin"
    android:layout_centerHorizontal="true"
    android:includeFontPadding="false"
    android:text="10.03"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="@dimen/font_size" />

    <Button
    android:id="@+id/buttonMenu"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:text="Menu" 
    android:onClick="onMenu"
    android:focusable="false"/>

</RelativeLayout>

In this screenshot, you will see that the border or area around the background is the area I want to reduce.

Screen shot

+5
source share
4 answers

Some negative upper and lower margins. Everything becomes messy, although if you have fancy backgrounds.

+4
source

.

0

I think the problem is with the padding / stock set in the textTimeToPin view . If you set any distance for this view, this will affect the placement of textTimeToCB , as it will be displayed below it.

View your xml for the surrounding views or paste it in full so that we can better observe.

0
source

Have you tried this ?:

android:padding="5dp"
-1
source

All Articles