【发布时间】:2020-05-07 06:54:35
【问题描述】:
我的线性布局有问题。 水平父母中有两个垂直的线性布局,第一个不采用第二个相同的高度。
这是我的线性布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@android:color/darker_gray">
<TextView
android:id="@+id/nomPers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nom User"
android:textColor="@android:color/black"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="@+id/dateVisite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
android:ellipsize="end"
android:text="Date"
android:textColor="@android:color/black"
android:textAppearance="?android:attr/textAppearanceMedium"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Type de visite"
android:id="@+id/typeVisteCli"
android:textColor="@android:color/black"
android:layout_marginLeft="5dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/tv_list_obs_visite_cli"
android:text="obs"
android:textColor="@android:color/black"
android:layout_marginLeft="5dp"/>
</LinearLayout>
</LinearLayout>
还有我所拥有的屏幕:
你可以看到灰色并没有填满整个linearLayout。 谢谢。
编辑
真的很抱歉我放错了LinearLayout ...
【问题讨论】:
-
相同的代码运行良好,所以你在recyclerview中的实现方式可能存在一些问题,所以你能把这段代码也分享一下吗?
-
@KaranMehta 我才意识到我放错了线性布局,我已经编辑了帖子,很抱歉
-
嗨@Neokerd 我看到了一些答案,如果你没有看到他们工作,让我知道我可以帮助你。
-
@Manikanta 现在可以了,但如果我需要有关 android studio 的帮助,我会来找你的 :)
-
嗨@Manikanta,请你帮我解决这一点stackoverflow.com/questions/59842015/…
标签: android android-layout layout android-linearlayout