gpt4 book ai didi

android - ConstraintLayout - 将小部件连接到障碍问题

转载 作者:行者123 更新时间:2023-12-05 06:16:59 30 4
gpt4 key购买 nike

我遇到了一个奇怪的问题:layout.xml

<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="match_parent">

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="wwwwwwwwwwwwwwwwwww" />

<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="wedwdwqefwerfwe"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="51dp" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="textView5,textView4"
tools:layout_editor_absoluteX="411dp" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="275dp"
tools:layout_editor_absoluteY="155dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

我正在尝试将一个小部件连接到我的屏障。问题是,当我尝试将我的小部件的 ENDbarrier 连接时,没有连接(我做不到,我拖放没有成功).这是我尝试连接的图像,但这是不可能的。 enter image description here

最佳答案

your quetion is still unclear but as I understand you are not able to connect view with barrier right?

enter image description here

    <?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="match_parent">

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="wwwwwwwwwwwwsdfdsfw"
android:textSize="@dimen/_15ssp"
app:layout_constraintEnd_toStartOf="@+id/barrier"
app:layout_constraintStart_toStartOf="parent" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_20sdp"
android:text="wedwdwqefwerfwe"
android:textSize="@dimen/_15ssp"
app:layout_constraintEnd_toStartOf="@+id/barrier"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView4" />

<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:constraint_referenced_ids="textView5,textView4"
tools:layout_editor_absoluteX="411dp" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/barrier"
tools:layout_editor_absoluteX="275dp"
tools:layout_editor_absoluteY="155dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

关于android - ConstraintLayout - 将小部件连接到障碍问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61860942/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com