【发布时间】:2021-09-18 13:01:18
【问题描述】:
我的android 应用程序中有一个activity,我想在其中显示完整的博客。博客有两件事,即图像和描述,后者有时会变得很长,具体取决于用户写的内容。图像和描述都来自服务器。现在我想像附图一样设计我的活动,我不知道这是否可以从xml 或java 完成。
我尝试在我的activity 中使用RelativeLayout,如下所示,但它没有覆盖ImageView 下方的空间。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
tools:context=".PostDetailsActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/postImg"
android:layout_width="200dp"
android:layout_height="200dp"
android:src="@drawable/logo" />
<TextView
android:layout_toRightOf="@id/postImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test" />
</RelativeLayout>
</ScrollView>
【问题讨论】: