Views
设备上无法显示 RelativeLayout
/ Lollipop
。我也尝试使用颜色资源而不是可绘制资源。之前我在View
内尝试使用RelativeLayout
,但没有效果。 View
/ Layout
内部的硬编码宽度为5 dp
。
<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>
答案 0 :(得分:1)
更改
<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"
/>
这应该可以正常工作。