【发布时间】:2020-01-10 10:11:38
【问题描述】:
无法更改在内部引用的单个视图的可见性 约束布局组
使用 实现'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
尝试使用 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'(稳定版) 但不工作。
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<View
android:id="@+id/bgView"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/full"
app:layout_constraintBottom_toTopOf="@id/bulletinsRV"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.github.mikephil.charting.charts.PieChart
android:id="@+id/chart"
android:layout_width="0dp"
android:layout_height="250dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="@color/white"
android:onClick="@{(v)->handler.onClickPieChart(v)}"
app:centerText="@{`Total Due:`+ vm.home.payment.totalAmount +` AED`}"
app:centerTextSize="@{vm.home.payment.paymentStatus.equals(`FullyPaid`)?0F:12F}"
app:description="@{vm.home.payment.paymentStatus.equals(`FullyPaid`)?``:`My payment`}"
app:dueCleared="@{vm.home.payment.paymentStatus.equals(`FullyPaid`)}"
app:goneWhen="@{vm.home.payment == null}"
app:isRotationEnabled="@{false}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:pieEntries="@{vm.pieEntries}"
app:touchEnabled="@{false}" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="bgView,chart"
app:visibleIf="@{vm.isUnitInitialized}" />
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
-
尝试使用这个实现 'androidx.constraintlayout:constraintlayout:1.1.3' 修改 build.gradle 中的代码
-
使用了这个,但它不起作用
标签: android android-layout android-constraintlayout