滚动视图内的约束布局使指导百分比相对于设备屏幕

时间:2018-04-18 23:36:10

标签: java android xml

好吧,现在我在Scroll View中有一个ConstraintLayout,我希望有两个指南,一个在0.055,另一个在0.33,通常我把它放在Constraint Layout中,它将是0.055的屏幕高度。但是,现在当我得到一个包裹ConstraintLayout的Scroll View时,似乎百分比是扩展的Scroll View。

布局看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="match_parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        ...

        <android.support.constraint.Guideline
            android:id="@+id/scrolling_guideline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintGuide_percent="0.055"
            android:orientation="horizontal" />

        <android.support.constraint.Guideline
            android:id="@+id/scrolling_guideline2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintGuide_percent="0.33"
            android:orientation="horizontal" />
    </android.support.constraint.ConstraintLayout>

</ScrollView>

有没有办法让指南的百分比再次“绝对”?感谢

0 个答案:

没有答案
相关问题