gpt4 book ai didi

android - 在 PreLollipop 设备中看不到 RelativeLayout 中的 View /布局

转载 作者:行者123 更新时间:2023-11-29 01:24:47 25 4
gpt4 key购买 nike

Views/RelativeLayoutLollipop 之前的设备上不可见。我还尝试使用颜色资源而不是可绘制资源。早些时候,我尝试在 RelativeLayout 中使用 View,但没有成功。 View/Layout 内的宽度硬编码为 5dp

<RelativeLayout
android:id="@+id/side_line1"
android:layout_alignTop="@+id/subject_content"
android:layout_alignBottom="@+id/subject_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:id="@+id/side_line_1"
android:visibility="visible"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
></RelativeLayout>

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:visibility="gone"
android:id="@+id/side_line_1_colored"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
></RelativeLayout>

<include
android:id="@+id/step_one"
android:layout_width="20dp"
android:layout_height="20dp"
layout="@layout/layout_step"
/>

</RelativeLayout>

enter image description here

enter image description here

最佳答案

改变

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:id="@+id/side_line_1"
android:visibility="visible"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
></RelativeLayout>

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:visibility="gone"
android:id="@+id/side_line_1_colored"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
></RelativeLayout>

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:id="@+id/side_line_1"
android:visibility="visible"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
/>

<RelativeLayout
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:layout_marginLeft="@dimen/pad_8_dp"
android:background="@drawable/bg_rect_round_corner_orange"
android:visibility="gone"
android:id="@+id/side_line_1_colored"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
/>

这应该可以正常工作。

关于android - 在 PreLollipop 设备中看不到 RelativeLayout 中的 View /布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34676212/

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