首页 > 解决方案 > 如何将约束放在片段上?

问题描述

我有一个带有两个 TextView 和一个 ImageView 的 Fragment,我想将约束放在这个视图上。我该怎么做?因为我在 Fragments 上只有边距,但在 Attributes 上看不到 Layout Constraints。

    <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".saludoscongratulationsfragment">

<!-- TODO: Update blank fragment layout -->
<TextView
    android:id="@+id/titulo"
    android:layout_width="300dp"
    android:layout_height="95dp"
    android:layout_marginTop="16dp"
    android:text="Lección completada!"
    android:textColor="@android:color/holo_red_dark"
    android:textSize="30sp"
   />

<ImageView
    android:id="@+id/fuegosartificiales"
    android:layout_width="match_parent"
    android:layout_height="386dp"
    android:layout_marginTop="92dp" />

谢谢

标签: androidandroid-fragments

解决方案


推荐阅读