mercredi 14 juin 2017

Android checkbox renders differently from same layout file

I have one layout file see below and it contains checkbox tag and this checkbox is rendered differently in two activities on same phone and system. How is it possible? In the first case it is a checkbox on left, in the second checkbox on right, but still same layout file.

list_row_check.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#000000">

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:text="itemtext"
        android:paddingLeft="8dip"
        android:paddingTop="15dip"
        android:paddingBottom="15dip"
        style="@style/ItemFont" />

    <CheckBox
        android:id="@+id/checkBox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:buttonTint="@color/custom_dark_red"
        />

    <include
        android:id="@+id/buttonShare"
        layout="@layout/btn_share"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_toLeftOf="@+id/checkBox"
        android:layout_marginRight="10dip"
        android:layout_centerVertical="true"
        android:visibility="gone" />

</RelativeLayout>

btn_share.xml (it contains layout for fb button) - this button is rendered in both cases plus minus same, except in case where is the small checkbox the button is bigger on width, maybe it is related with space for checkbox. I can attach real case checkboxes screen.

<LinearLayout
    xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/buttonShare">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="30dip"
        android:layout_height="30dip"
        android:src="@drawable/ic_button_sdilet_fb"
        android:scaleType="fitXY"
        android:contentDescription="@string/content_description" />

    <Button
        android:id="@+id/buttonShare1"
        android:layout_width="wrap_content"
        android:layout_height="30dip"
        android:text="@string/button_share"
        android:background="@color/com_facebook_blue"
        android:paddingLeft="10dip"
        android:paddingRight="10dip"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        android:textSize="12sp" />

</LinearLayout>

enter image description here




Aucun commentaire:

Enregistrer un commentaire