alibaba / vlayout

Project vlayout is a powerfull LayoutManager extension for RecyclerView, it provides a group of layouts for RecyclerView. Make it able to handle a complicate situation when grid, list and other layouts in the same recyclerview.
http://tangram.pingguohe.net/
MIT License
10.8k stars 1.79k forks source link

FixLayoutHelper不支持constraintLayout里面的0dp #497

Open leenickcode opened 4 years ago

leenickcode commented 4 years ago
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/tv_add_car"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:id="@+id/ll_call"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/iv_call"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

               android:src="@mipmap/add_bank" />

            <TextView
                android:id="@+id/tv_call"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="联系客服" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:id="@+id/ll_collection"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/iv_collection"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@mipmap/add_bank" />

            <TextView
                android:id="@+id/tv_collection"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="关注" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:id="@+id/ll_shopping_car"
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageView5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:src="@mipmap/add_bank" />

            <TextView
                android:id="@+id/textView10"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="购物车" />
        </LinearLayout>
    </LinearLayout>
    <TextView
        android:id="@+id/tv_add_car"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:background="@drawable/bg_conner_add_car"
        android:padding="@dimen/dp_5"
        android:text="加入购物车"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/tv_pay"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/linearLayout"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/tv_pay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:background="@drawable/bg_conner_pay"
        android:padding="@dimen/dp_5"
        android:text="立即结款"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

布局如上,linerlayout的内容不会显示出来

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        return new FixLayoutHelper(FixLayoutHelper.BOTTOM_LEFT,100,0);
    }