【问题标题】:How to create layout without circular dependencies如何创建没有循环依赖的布局
【发布时间】:2016-11-14 14:58:16
【问题描述】:

我需要建议如何创建将在应用程序底部显示带有应用程序版本文本字段的横幅(挥动线)的布局。像这样的东西

A 设法创建了这样的布局,这显然不好,因为它跨越了所有屏幕:

因为我在那里有循环依赖项,如下所述:enter link description here

所以我已经删除了依赖项 完成更好的事情:

xml的重要部分在这里:

<RelativeLayout
    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="visible"
    android:layout_alignParentBottom="true">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentEnd="true"
        android:src="@drawable/ic_devicescreenlogo"
        />
    <TextView
        android:id="@+id/version"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:paddingBottom="5dp"
        android:paddingStart="5dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="@color/textunselected"
        android:text="Version"/>
</RelativeLayout>

感谢您的帮助。

【问题讨论】:

    标签: android android-layout android-relativelayout


    【解决方案1】:

    您可以使用FrameLayout 代替RelativeLayout 以便将一个视图叠加到另一个视图之上。

    【讨论】:

      猜你喜欢
      • 2013-02-10
      • 2019-07-20
      • 1970-01-01
      • 2023-03-06
      • 1970-01-01
      • 2018-06-02
      • 1970-01-01
      • 1970-01-01
      • 2017-11-25
      相关资源
      最近更新 更多