Quantico
Quantico

Reputation: 2446

android listView minimize a gap between text and subtext

minimize the gap that I have between two TextViews (main text and subtext) that are in a linear layout and vertical. I tried to pad the subtext to the top, change the hight of the subtext and change the top margin but the gap remains, and I just get a row with an unnecessary hight. My XML is attached

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp">

    <ImageView
        android:id="@+id/imgIcon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:scaleType="fitStart"       
        android:layout_marginTop="5dp" 
        android:layout_marginRight= "10dp"
        android:gravity="center_vertical" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/txtTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:textColor="#000000"            
            android:textSize="20sp" 


            />

        <TextView
            android:id="@+id/subString"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"                        
             />

    </LinearLayout>

</LinearLayout>

this is a picture of what it should look like enter image description here but what I actually have is a big gap between IMDB and account

Upvotes: 0

Views: 365

Answers (1)

Oleg Vaskevich
Oleg Vaskevich

Reputation: 12682

Your screenshot isn't showing up, but one thing you can try that's worked for me before is to set the bottom margin of your title and top margin of your subString to negative; i.e.

<TextView
    android:id="@+id/txtTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginBottom="-10dp"
    android:textColor="#000000"            
    android:textSize="20sp" />

Upvotes: 1

Related Questions