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

我在父容器为约束布局内使用,悬浮气泡位置偏移了应该怎么办呢?设置correctOffsetWhenContainerOnScrolling无效 #213

Open
roybill opened this issue Mar 1, 2024 · 0 comments

Comments

@roybill
Copy link

roybill commented Mar 1, 2024

1.布局:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_right"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintHorizontal_weight="1.5"
app:layout_constraintLeft_toRightOf="@id/cl_left"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/cl1"
                android:layout_width="match_parent"
                android:layout_height="20dp"
                android:background="@drawable/grey_5dp_shape"
                app:layout_constraintTop_toTopOf="parent">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/tv_buy"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:background="@drawable/buy_shape"
                    android:gravity="center"
                    android:text="买入"
                    android:textColor="@color/white"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/tv_sell"
                    app:layout_constraintTop_toTopOf="parent" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/tv_buy_triangle"
                    android:layout_width="20dp"
                    android:layout_height="match_parent"
                    android:background="@drawable/buy_triangle_shape"
                    android:visibility="visible"
                    app:layout_constraintLeft_toRightOf="@id/tv_buy"
                    app:layout_constraintTop_toTopOf="parent" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/tv_sell"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:gravity="center"
                    android:text="卖出"
                    android:textColor="@color/grey"
                    app:layout_constraintHorizontal_weight="1"
                    app:layout_constraintLeft_toRightOf="@id/tv_buy"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/tv_sell_triangle"
                    android:layout_width="20dp"
                    android:layout_height="match_parent"
                    android:background="@drawable/sell_triangle_shape"
                    android:visibility="gone"
                    app:layout_constraintRight_toLeftOf="@id/tv_sell"
                    app:layout_constraintTop_toTopOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/tv_limit_order"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dip_5"
                android:background="@drawable/grey_solid_5dp_shape"
                android:gravity="center"
                android:padding="@dimen/dip_5"
                android:text="限价单"
                android:textColor="@color/black"
                android:textStyle="bold"
                app:layout_constraintTop_toBottomOf="@id/cl1" />

            <!--需要自定义view设置背景-->
            <com.bevex.view.MatEditText
                android:id="@+id/et_price"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dip_5"
                android:background="@drawable/grey_solid_5dp_shape"
                android:gravity="center"
                android:hint="价格(usdt)"
                android:inputType="number"
                android:lines="1"
                android:maxLength="20"
                android:padding="@dimen/dip_2"
                android:textSize="@dimen/sp_13"
                app:layout_constraintTop_toBottomOf="@id/tv_limit_order"
                app:met_floatingLabel="normal"
                app:met_hideUnderline="true" />

            <com.bevex.view.MatEditText
                android:id="@+id/et_amount"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dip_5"
                android:background="@drawable/grey_solid_5dp_shape"
                android:gravity="center"
                android:hint="数量(ETH)"
                android:inputType="number"
                android:lines="1"
                android:maxLength="20"
                android:padding="@dimen/dip_2"
                android:textSize="@dimen/sp_13"
                app:layout_constraintTop_toBottomOf="@id/et_price"
                app:met_floatingLabel="normal"
                app:met_hideUnderline="true" />

            <com.xw.repo.BubbleSeekBar
                android:id="@+id/bsb_trading"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dip_5"
                app:bsb_bubble_color="@color/color_red_light"
                app:bsb_bubble_text_color="@color/colorPrimaryDark"
                app:bsb_max="100"
                app:bsb_min="0"
                app:bsb_progress="0"
                app:bsb_second_track_color="@color/color_red"
                app:bsb_section_count="4"
                app:bsb_section_text_position="bottom_sides"
                app:bsb_show_progress_in_float="false"
                app:bsb_show_section_mark="true"
                app:bsb_show_section_text="true"
                app:bsb_show_thumb_text="true"
                app:bsb_track_color="@color/color_red_light"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintTop_toBottomOf="@id/et_amount" />

        </androidx.constraintlayout.widget.ConstraintLayout>

2.代码:
binding.clRight.setOnScrollChangeListener{v, scrollX, scrollY, oldScrollX, oldScrollY ->
binding.bsbTrading.correctOffsetWhenContainerOnScrolling();
}

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