/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 在项目上右 ...
随机推荐
- SDP协议中的Continuation State
在SDP request和SDP response中,最后一部分为Continuation State,结构如下: 它用于一次response不够把所有的Data传回去的情况.这时候需要将respon ...
- 关于xampp使用不同端口的虚拟机
1.打开apache/conf/httpd.conf文件加入listen 8080(监听的端口号) 然后加入 # Virtual hostsInclude "conf/extra/httpd ...
- Lazarus for Raspbian安装
春节前看到树莓派 2代开始销售,第一时间在淘宝下单购买,无奈春节期间放假,要到3月份才可能收到,只能用QEMU模拟器先熟悉树莓系统.对从turbo Pascal开始的人来讲,如果能在树莓系统使用Pas ...
- sublime修改TAB缩进
菜单:Preferences ->Settings – User 添加配置信息: "tab_size": 4, "translate_tabs_to_spaces& ...
- [LeetCode]题解(python):061-Rotate list
题目来源 https://leetcode.com/problems/rotate-list/ Given a list, rotate the list to the right by k plac ...
- [LeetCode]题解(python):035-Search Insert Position
题目来源 https://leetcode.com/problems/search-insert-position/ Given a sorted array and a target value, ...
- PySe-005-基础环境配置(Win7)
之前的文章讲述了如何在 MacOX 下配置 Python + Selenium2 的 WebUI测试自动化环境配置,敬请参阅 PySe-001-基础环境配置(MacOX). 此文主要讲述如何配置 Py ...
- LeetCode Meeting Rooms II
原题链接在这里:https://leetcode.com/problems/meeting-rooms-ii/ Given an array of meeting time intervals con ...
- MySQL: 详细的sql语句
1添 1.1[插入单行] insert [into] <表名> (列名) values (列值)例:insert into Strdents (姓名,性别,出生日期) values ('开 ...
- 微信小店分类ID列表
一级分类 { , "errmsg": "ok", "cate_list": [ { ", "name": &q ...