易网时代-编程资源站
Welcome
微信登录
编程资源
图片资源库
蚂蚁家优选
PDF转换器
软件资源
软件开发
、
小程序制作
、
系统集成与运维
、
空间租用
、
硬件开发
、
视频监控
、
技术咨询与支持
——联系电话:0311-88999002/88999003
首页
/
操作系统
/
Linux
/
Android 图片水平显示 类Gallery效果
HorizontalScrollView scrollView = (HorizontalScrollView)
this
.findViewById(R.id.scrollView);
TableRow row = (TableRow) scrollView.findViewById(R.id.row);
for
(
int
i =
0
; i <
5
; i++) {
ImageView imageView =
new
ImageView(
this
);
imageView.setImageResource(R.drawable.k);
row.addView(imageView);
}
this
.setContentView(scrollView);
布局文件
<?xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<HorizontalScrollView
Android:id
=
"@+id/scrollView"
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
>
<TableLayout
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
>
<TableRow
android:id
=
"@+id/row"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
/>
</TableLayout>
</HorizontalScrollView>
收藏该网址
版权所有©石家庄振强科技有限公司2024
冀ICP备08103738号-5
网站地图