[问题解决]我不知道为什么高度:wrap_content不能正常工作,我只是改变它匹配父。无论如何,问题解决了。不想再花更多时间在这个奇怪的事情上。android LinearLayout显示问题
我正在使用LinearLayout构造CardView。但是,我有这种奇怪的情况。 Jinesh Francis的代码完美地工作,但是当我将配置复制并粘贴到我的代码中时,问题保持不变。
为什么不能长标题完全显示?
布局如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/movieCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_gravity="center"
android:background="@color/bacgroundCardView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/movieImage"
android:layout_width="70dp"
android:layout_height="90dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:scaleType="fitXY"
android:src="@drawable/selfie" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp">
<TextView
android:id="@+id/movieTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:textSize="15dp"
android:textColor="#000"
android:textStyle="bold"
android:text="Long long long long long long long long Title"/>
<TextView
android:id="@+id/movieRating"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:textSize="12dp"
android:textStyle="bold"
android:text="7.0" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:scaleX="0.70"
android:scaleY="0.70" />
</LinearLayout>
<TextView
android:id="@+id/movieDescription"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textSize="10dp"
android:text="So many many many many many many many many many many many many description" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
感谢您的任何建议
这是不够的,只写XML标记。编辑您的帖子并包含属性。 – Karakuri
发布您的完整布局文件 –
您在relativeLayout中使用LinearLayout,并设置标题的权重..这就是为什么它给这个输出 – NehaK