vendredi 28 avril 2017

Android - Checkbox centering and filling layout

I have a spinner which has an item template. Inside I have a textview and a checkbox that fills the layout, but it is fixed at left border (see image). How do I make checkbox centered, while not wrapping it's content? Padding and margins don't work.

Link to checkbox image

Item template layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    xmlns:local="http://ift.tt/GEGVYd"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/listPreferredItemHeight">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="1">
        <TextView
            style="?android:attr/spinnerDropDownItemStyle"
            android:background="@drawable/location_item_dash"
            android:foreground="#000"
            android:ellipsize="marquee"
            android:singleLine="true"
            android:textColor="#FFFFFF"
            local:MvxBind="Text LocationName"
            android:id="@+id/spinnertext"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.8" />
        <CheckBox
            local:MvxBind="Checked Selected"
            android:background="@drawable/location_item_dash"
            android:id="@+id/spinnercheck"
            android:gravity="center"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.2"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:layout_centerInParent="true" />
    </LinearLayout>
</LinearLayout> 




Aucun commentaire:

Enregistrer un commentaire