我需要实现以下界面: 的TextView在RelativeLayout的不适当的对准
对于这一点,我现在用的是以下布局:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white">
<ImageView
android:id="@+id/news_image0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/news_cell0_imageview_min_height"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<RelativeLayout
android:id="@+id/news0_cell_image_overlay_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/news_image0"
android:layout_alignTop="@+id/news_image0"
android:layout_alignLeft="@+id/news_image0"
android:layout_alignStart="@+id/news_image0"
android:layout_alignEnd="@+id/news_image0"
android:layout_alignRight="@+id/news_image0"
android:background="@drawable/news_cell0_overlay_gradient">
<TextView
android:id="@+id/news_title0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical|start"
android:layout_alignParentBottom="true"
android:maxLines="3"
android:ellipsize="end"
android:textColor="@color/colorNewsCellType0TitleText"
android:layout_margin="@dimen/news_cell0_textview_margin"
android:textSize="@dimen/news_cell0_title_text_size"
android:typeface="monospace" />
</RelativeLayout>
</RelativeLayout>
走进我从一个加载使用毕加索图像的ImageView URL。我在大多数设备上都能正确获得输出,但在运行Android的设备中,某些设备比Lollipop少,因此会显示如下截图。文本显示在顶部,而不是底部。但是我为TextView设置了android:layout_alignParentBottom="true"
。 RelativeLayout
呈现正确,它适合图像(它有一个背景渐变,可以清楚地看到在图像的底部)。
是什么原因造成这个问题,我怎么能解决这个问题?
机器人:layout_alignParentBottom = “真” 为news0_cell_image_overlay_layout – Raj