java - 如何在 scollview 中的图像上方添加 textview?
问题描述
我需要在具有背景图像的滚动视图上方放置一个 textView。但我尝试放置 textView 并移动到其他 sid 或不随滚动移动。
这是我的xml。
<ScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:gravity="top"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageViewObrazekGeometrie"
android:layout_width="500dp"
android:layout_height="777dp"
android:paddingRight="120dp"
android:src="@drawable/dataviewer" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>
</ScrollView>
解决方案
我真的不能正确理解你的问题,但会分享你哪里出错了。滚动视图只能容纳一个孩子,但在您的情况下,您的 HorizontalScrollView 有两个孩子,一个是 LinearLayout,另一个是 TextView,请将两者都插入到一个父布局中。
推荐阅读
- javascript - 使用 Firestore 显示简单的博客文章
- jquery - 如何在文本中找到最大日期?
- python - 写入 csv 时跳过第一行 (pandas.DataFrame.to_csv)
- python - 我在哪里将我的 python 文件放在 venv 文件夹中?
- javascript - iOS中的React Video重新渲染问题
- javascript - 用于从表中选择数据的多个复选框
- c# - Howto: Avoid EF creating Id
- python - 从依赖于交互式地图的表中抓取数据
- azure-devops - VSTS - External Git
- javascript - Real time chat using PHP and JS