android - 框架布局中相对布局中的滚动视图
问题描述
我有一个很大的问题。我想滚动我在相对布局中的 FrameLayout。框架布局创建 2 个图像循环,我希望每个图像都显示(在 2 列中)并且滚动视图有效。
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frame1"/>
</RelativeLayout>
</ScrollView>
for (int y=0; y < 3; y++) {
for (int i = 0; i < 20; i++) {
index = "car_0";
final ImageView car = new ImageView(SecondActivity.this);
car.setLayoutParams(iparams);
car.setImageResource(R.drawable.car_0);
car.setY(i * size.y/3-5);
car.setX(y * size.x/3-5);
frameLayout.addView(car);
}
}
解决方案
推荐阅读
- reactjs - 子上下文未定义
- python - 使用 pandas column orient 转换为没有索引值的 JSON
- sql - 寻求通过 sql 排列表中的列但保留所有其他列
- ios - 动态 UICollectionViewCell 未对齐
- python - 当脚本等待外部输入时,openCV 预览窗口冻结
- reactjs - 如何克服 Typescript 错误“找不到名称‘模块’?”
- javascript - 在回调函数的生命周期之外持久化数据
- reactjs - 商店没有有效的减速器。确保传递给 combineReducers 的参数是一个其值为 reducers 的对象。我正面临这个问题
- c - C中的fread指针
- scala - 在 Apache Spark Scala 中将带有数组的嵌套 json 展平为单行数据帧