.define xml

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearView"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"> </LinearLayout> </ScrollView> . code package com.example.demo10scrollview; import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout; public class MainActivity extends Activity { private String data[]={"www.csdn.com","www.baidu.com","wwww.alamps.com","www.iteye.com","www.google.com","www.qq.com"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); //定义第二层LinearLayout
LinearLayout linearLayout=(LinearLayout)super.findViewById(R.id.linearView);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
for (int i=;i<this.data.length;i++){
Button button = new Button(this);
button.setText(this.data[i]);
linearLayout.addView(button,params); }
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }

/Users/alamps/AndroidStudioProjects/Demo10ScrollView的更多相关文章

  1. /Users/alamps/AndroidStudioProjects/Demo11ListView

    package com.example.demo11listview; import android.os.Bundle; import android.app.Activity; import an ...

  2. demo16Toast

    /Users/alamps/AndroidStudioProjects/demo16Toast/demo16Toast/src/main/res/layout/activity_main.xml &l ...

  3. demo14

    /Users/alamps/AndroidStudioProjects/Demo12SimpleAdapter/Demo12SimpleAdapter/src/main/res/layout/tabl ...

  4. Demo12SimpleAdapter

    /Users/alamps/AndroidStudioProjects/Demo12SimpleAdapter/Demo12SimpleAdapter/src/main/res/layout/data ...

  5. Error:C:\Users\issuser\AndroidStudioProjects\SQLiteDemo1\.gradle\buildOutputCleanup\cache.properties (系统找不到指定的文件。)

    android studio报下图中的这个错误的解决办法: 解决办法: 1.删除掉下图中标记的2个文件夹 2.将下图标记的文件的文件名重命名,把最后的后缀.lock去掉,因为加上了这个后缀,所以提示找 ...

  6. mac tomcat

    alampsdeMacBook-Pro:bin alamps$ ./startup.sh Using CATALINA_BASE: /Users/alamps/Library/apache-tomca ...

  7. Android安全攻防战,反编译与混淆技术完全解析(下)

    在上一篇文章当中,我们学习了Android程序反编译方面的知识,包括反编译代码.反编译资源.以及重新打包等内容.通过这些内容我们也能看出来,其实我们的程序并没有那么的安全.可能资源被反编译影响还不是很 ...

  8. 完全卸载AndroidStudio

    一:卸载Android Studio 由于从1.5正式版直接升级到2.1的版本,整个项目构建都变得异常的慢,所以决定卸载重新安装2.0的正式版.但是Mac下使用dmg安装的app很多都是不能使用拖拽的 ...

  9. Andriod学习笔记5:通过NDK在C++中实现日志输出

    开发环境 android studio 1.5.1 实现步骤 新建android项目 项目名称为AndroidCLog,选择Empty Activity模板,其他默认即可. 下载配置ndk 在项目上右 ...

随机推荐

  1. Visual Mingw

    Visual-MinGW 是一个专门为MinGW所设计的IDE.如果,你曾经用过VC++ 6.0这个IDE,你的第一感觉就是,Visual-MinGW和VC++ 6.0非常相似.所以,对于曾经用惯VC ...

  2. Apache Commons Codec 编码解码

    Apache Commons Codec jar包官方下载地址 下载解压后把commons-codec-1.9.jar 放到lib中 关于SHA1算法的介绍可以参看Wiki:http://en.wik ...

  3. C++经典编程题#2:大象喝水

    总时间限制:  1000ms 内存限制:  65536kB 描述 一只大象口渴了,要喝20升水才能解渴,但现在只有一个深h厘米,底面半径为r厘米的小圆桶(h和r都是整数).问大象至少要喝多少桶水才会解 ...

  4. windows 2008R2 无法安装操作系统补丁,或无法安装Sp1升级包的解决办法

    windows 2008R2 无法安装操作系统补丁,或无法安装Sp1升级包的解决办法 给 C:\ 加上users读取和执行,,列出文件夹内容,及读取的权限,不需要就用到子目录 将 C:\Windows ...

  5. SQL-Server2008 数据库发布订阅

    参考博客园文章http://www.cnblogs.com/tyb1222/archive/2011/05/31/2064944.html 添加安全数据库 更改数据库名称 SQL语句 select @ ...

  6. Java Set操作

    Set:无顺序,不包含重复的元素 HashSet:为快速查找设计的Set.存入HashSet的对象必须定义hashCode(). TreeSet: 保存次序的Set, 底层为树结构.使用它可以从Set ...

  7. python_GUI

    1. 需要安装wxPython软件 2.  GUI(图形用户界面)代码的编写顺序 备注: 1. 加入面板和布局管理器,可以使得组件的位置和大小更加灵活 3. 示例: #encoding=utf-8 i ...

  8. [转载]windows任务管理器中的工作设置内存,内存专用工作集,提交大小详解

    windows任务管理器中的工作设置内存,内存专用工作集,提交大小详解 http://shashanzhao.com/archives/832.html 虽然是中文字,但是理解起来还是很困难,什么叫工 ...

  9. [转载]WGS84坐标与Web墨卡托坐标互转

    //经纬度转Wev墨卡托 dvec3 CMathEngine::lonLat2WebMercator(dvec3 lonLat) { dvec3 mercator; ; +lonLat.y)*PI/) ...

  10. SQL 的简单命令(增删改查)

    数据库操作的资料: 链接: https://pan.baidu.com/s/1dFl3q6X 密码: nvy7-- 增:insert into 表名 (列名) values (值) ,'dew') - ...