Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clipped child views on Android 4.1 - 4.3 #77

Open
KKKoTTT opened this issue Nov 9, 2016 · 1 comment
Open

Clipped child views on Android 4.1 - 4.3 #77

KKKoTTT opened this issue Nov 9, 2016 · 1 comment

Comments

@KKKoTTT
Copy link

KKKoTTT commented Nov 9, 2016

On Android versions 4.1 - 4.3 (api levels 16-18) child views have wrong widths and heights after including layouts with margins. See pic below:
flowbug
If margins = 0 views are not clipped and everything is ok.

<org.apmem.tools.layouts.FlowLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="start|center">
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
                <include layout="@layout/layout_text"/>
</org.apmem.tools.layouts.FlowLayout>

layout_text.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true">
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="@dimen/tag_margin"
        android:layout_marginBottom="@dimen/tag_margin">
        <com.devspark.robototextview.widget.RobotoTextView
            android:id="@+id/tv_text"
            android:background="@color/accent"
            android:padding="8dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fontFamily="roboto"
            app:textWeight="medium"
            app:textStyle="normal"
            android:text="TEST"
            android:textSize="14sp"
            android:textColor="@color/c_primary_dark"
            android:layout_centerVertical="true" />
    </RelativeLayout>
</RelativeLayout>


@KKKoTTT
Copy link
Author

KKKoTTT commented Nov 9, 2016

The problem can be solved by using paddings instead of margins. However i suppose this is a bug.

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:paddingRight="@dimen/tag_margin"
    android:paddingBottom="@dimen/tag_margin">
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <com.devspark.robototextview.widget.RobotoTextView
            android:id="@+id/tv_text"
            android:background="@color/accent"
            android:padding="8dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:fontFamily="roboto"
            app:textWeight="medium"
            app:textStyle="normal"
            android:text="TEST"
            android:textSize="14sp"
            android:textColor="@color/c_primary_dark"
            android:layout_centerVertical="true" />
    </RelativeLayout>
</RelativeLayout>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant