我需要實現以下界面: 的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