我正在尝试使用右箭头和垂直线以及其右侧的2个文本视图构建布局。在设备中查看不可见,但在XML中可见
此布局将在RecyclerView
被用于这是我使用的代码,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:clickable="true"
android:id="@+id/rootLayout"
>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_margin="@dimen/app_margin"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
>
<View
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:id="@+id/lineView"
android:layout_marginLeft="15dp"
android:background="@color/colorPrimary"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/name"
android:layout_toRightOf="@+id/lineView"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/type"
android:layout_toRightOf="@+id/lineView"
android:layout_below="@+id/name"
/>
<android.support.v7.widget.AppCompatImageView
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="@drawable/right_arrow"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:id="@+id/right_arrow"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
这是上述布局的结果
的当我在我的设备上运行输出时,蓝色线条不可见,但如图所示以XML显示
个我的问题
- 我如何让它在我的设备可见?
- 蓝线是非常大的我试过
wrap_content
但仍然没有工作
我尝试这样做的代码和蓝线是在两个编辑器和实际的装置可见。你在用哪种设备? –
@NovoLucas设备是红米Note 3 –
奇怪的是,即使我使用红米,它是可见的。虽然解决问题的好处很多。 –