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"?><HorizontalScrollViewandroid:id="@+id/scrollView"xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent" android:layout_height="fill_parent"        android:scrollbars="none"><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>



更多相关文章

  1. Android动态添加布局
  2. 解决Android Studio XML布局格式化无法换行的问题
  3. 【Android】debug 状态下其签名文件 debug.keystore 相关(如何获
  4. Android 文件上传支持拍照录用录视频
  5. Android 的res/values/colors自定义颜色列表和注释表及布局文件
  6. 新建android project和其配置文件的基本介绍
  7. Android使用adb命令直接修改文件
  8. CrossWalk - Android 动态加载so库文件
  9. Android线性LinearLayout布局xml属性介绍

随机推荐

  1. 日志分析工具Log Parser介绍
  2. Dynamics CRM Web API中的and和or组合的
  3. 介绍Dynamics 365 Performance Center
  4. 介绍Dynamics 365的OrgDBOrgSettings工具
  5. 为Dynamics 365写一个简单程序实现解决方
  6. JWT可以很好的应用在restful api模式上
  7. Dynamics 365 Customer Engagement中插件
  8. 自定义工作流活动运行产生System.Securit
  9. Exchange2016和2019的架构分享
  10. Dynamics 365中自定义工作流活动获取的上