在ImageView之后显示TextView

Ami*_*pta 5 android textview imageview android-layout

我想在TextView之后显示ImageView但是现在正在我的Android屏幕上显示文字.

布局:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.sitemakers.sitemakers.AboutFragment">

<ImageView
    android:id="@+id/about_image"
    android:src="@drawable/sitemakers_laptops"
    android:layout_width="match_parent"
    android:scaleType="fitXY"
    android:layout_height="420dp" />

<TextView
    android:layout_below="@+id/about_image"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Site Makers is the web development company engage in the.."
    />

</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

预习

请看上面的截图,并帮助我XML以这样的方式更新我,以便TextView将来ImageView.

Pav*_*ngh 7

替换FrameLayoutLinearLayoutRelativeLayout因为FrameLayout将视图放在另一个上

LinearLayout :将子视图以线性方式放置,一个接一个地水平或垂直放置.

注意:线性布局还允许您根据指定的weight属性值动态分配子视图中的可用宽度和高度.

RelativeLayout :布局,其中可以相对于彼此或与父母相关地描述孩子的位置

ViewGroups you can use根据说明,还有许多其他的

注意:不要使用px而是使用dpas android:layout_height="420dp"因为px代表实际屏幕像素限制在大屏幕上保持相同的视图大小(视图将非常小),如此处所述Density independence