Search code examples
androidandroid-layouttextviewchronometer

Controlling margins of Android Chronometer


I have a layout with a Chronometer between 2 TextView:

<TextView
    android:id="@+id/feed_current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/current"
    android:textSize="14sp"
    android:textColor="@color/feed_last_and_current"
    android:layout_alignTop="@+id/feed_last"
    android:layout_centerHorizontal="true"
    android:padding="0dp" />

<Chronometer
    android:id="@+id/feed_chronometer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="40sp"
    android:textColor="@color/panel_text"
    android:layout_alignLeft="@id/feed_current"
    android:layout_below="@id/feed_current"
    android:padding="0dp" />

<TextView
    android:id="@+id/feed_action"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/start"
    android:textSize="25sp"
    android:paddingBottom="3dp"
    android:textColor="#FFFFFF"
    android:layout_below="@+id/feed_detail"
    android:layout_alignLeft="@+id/feed_chronometer"
    android:layout_alignStart="@+id/feed_chronometer" />

I've tried everything but Chronometer seems to create a margin between it and its surroundings.

Chronometer and surroundings Do you have any idea how to remove those gap?

Thanks


Solution

  • You can have negative margins for your items.

    so for your bottom TextView you can have layout_marginTop="-25" or whatever margin is needed.