/Users/alamps/AndroidStudioProjects/Demo10ScrollView
.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的更多相关文章
- /Users/alamps/AndroidStudioProjects/Demo11ListView
package com.example.demo11listview; import android.os.Bundle; import android.app.Activity; import an ...
- demo16Toast
/Users/alamps/AndroidStudioProjects/demo16Toast/demo16Toast/src/main/res/layout/activity_main.xml &l ...
- demo14
/Users/alamps/AndroidStudioProjects/Demo12SimpleAdapter/Demo12SimpleAdapter/src/main/res/layout/tabl ...
- Demo12SimpleAdapter
/Users/alamps/AndroidStudioProjects/Demo12SimpleAdapter/Demo12SimpleAdapter/src/main/res/layout/data ...
- Error:C:\Users\issuser\AndroidStudioProjects\SQLiteDemo1\.gradle\buildOutputCleanup\cache.properties (系统找不到指定的文件。)
android studio报下图中的这个错误的解决办法: 解决办法: 1.删除掉下图中标记的2个文件夹 2.将下图标记的文件的文件名重命名,把最后的后缀.lock去掉,因为加上了这个后缀,所以提示找 ...
- mac tomcat
alampsdeMacBook-Pro:bin alamps$ ./startup.sh Using CATALINA_BASE: /Users/alamps/Library/apache-tomca ...
- Android安全攻防战,反编译与混淆技术完全解析(下)
在上一篇文章当中,我们学习了Android程序反编译方面的知识,包括反编译代码.反编译资源.以及重新打包等内容.通过这些内容我们也能看出来,其实我们的程序并没有那么的安全.可能资源被反编译影响还不是很 ...
- 完全卸载AndroidStudio
一:卸载Android Studio 由于从1.5正式版直接升级到2.1的版本,整个项目构建都变得异常的慢,所以决定卸载重新安装2.0的正式版.但是Mac下使用dmg安装的app很多都是不能使用拖拽的 ...
- Andriod学习笔记5:通过NDK在C++中实现日志输出
开发环境 android studio 1.5.1 实现步骤 新建android项目 项目名称为AndroidCLog,选择Empty Activity模板,其他默认即可. 下载配置ndk 在项目上右 ...
随机推荐
- 蓝牙BLE LINK LAYER剖析(一) -- status and channel
一.LINK LAYER STATES 二.PHYSICAL CHANNEL
- C# Json时间类型的转换
DateTime dt1 = new DateTime(1970, 1, 1); dt1 = dt1.AddMilliseconds(long.Parse(list.Items[i].UpdatedA ...
- 使用NSTimer过程中最大的两个坑
坑1. retain cycle问题. 在一个对象中使用循环执行的nstimer时,若希望在对象的dealloc方法中释放这个nstimer,结局会让你很失望. 这个timer会导致你的对象根本不会被 ...
- C/C++预处理和编译
预处理器的作用 当我们对源代码进行编译时,第一个阶段就是进行预处理.以#开头的都是预处理指令,都会被预处理器处理掉. 也就是说:我们写的代码,不是直接被编译,而是先被预处理器进行修改.那么预处理器如何 ...
- 关于android获得设备宽高
传统的办法: DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(d ...
- EntityFramework更新数据
1.TryUpdateModel 使用很方便,但实际更新数据的过程还是先select,再update.另外发现一个问题,对于input的type类型file的字段,无法使用TryUpdateModel ...
- [LeetCode]题解(python):062 Unique path
题目来源 https://leetcode.com/problems/unique-paths/ A robot is located at the top-left corner of a m x ...
- Android笔记:Select at least one project解决办法
导入项目的时候发现无法导入,最上方提示“Select at least one projec” 百度了一下,原来是和上一个项目名称相同了,直接把重名项目重命名后再导入即可.
- Number类型
这是计算基础,复杂的以后不充. 1.Number(); var box = { toString :function(){ return '123'; } }; alert(Number(box)); ...
- js获取时间戳
1.var now = Date.parse(new Date()); //例:1467342220000 获取的时间戳是把毫秒改成000显示. 2.var now = new Date().valu ...