<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" id="mixia_vpid">
<title>
Android代码速查,写给新手的朋友们 - OPEN开发经验库
</title>
<meta name="description" content="Android代码速查,写给新手的朋友们 ">



<link rel="shortcut icon" href="http://static.open-open.com/favicon.ico" type="image/x-icon">
<link href="http://m.open-open.com/m/static/application.css" media="screen" rel="stylesheet" type="text/css">
<link href="http://m.open-open.com/m/static/font-awesome.css" rel="stylesheet">
<script src="http://push.zhanzhang.baidu.com/push.js"></script><script src="http://m.open-open.com/m/static/application.js" type="text/javascript"></script>

<script type="text/javascript" src="http://m.open-open.com/m/static/spin.js"></script><style type="text/css"></style><style type="text/css"></style>
<link rel="stylesheet" href="http://m.open-open.com/m/static/github.css">

</head><body>



<div id="header" class="navbar-fixed-top">
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a href="http://m.open-open.com/m" class="brand">Open-Open</a>
<nav class="nav-collapse collapse">

<form class="navbar-search pull-left" action="http://m.open-open.com/m/doc/search" method="post" accept-charset="utf-8" onsubmit="document.charset='utf-8';">
<input class="search-query span2" name="q" placeholder="搜索文档" value="" type="text">
</form>
<ul class="nav pull-right">

<li><a href="http://m.open-open.com/m/members/login">登录</a></li>


</ul>
</nav>
</div>
</div>

<style>
/*line menu*/
.line.menu { display: flex; font-size: 1em; } .line.menu .tab { align-self: flex-end; border-radius: 0; padding: 20px 1.14286em 0; transition: color 0.1s ease 0s; text-decoration: none; text-transform: none; color: rgba(0, 0, 0, 0.87); cursor: pointer; } .line.menu .active { border-bottom:2px solid #3399ff; } .line.menu .tab:hover { border-color: rgba(0, 0, 0, 0.5); }
/*line menu*/
</style>
<div class="line menu">
<a class="tab " href="http://m.open-open.com/m/news/">资讯 </a>&nbsp;
<a class="tab " href="http://m.open-open.com/m/doc/">文档</a>&nbsp;
<a class="tab active" href="http://m.open-open.com/m/lib/">经验库</a>&nbsp;
<a class="tab " href="http://m.open-open.com/m/code/">代码</a>&nbsp;
</div>

</div>
</div>

<div id="flash_container" class="noPrint">
</div>

<div class="container-fluid" style="padding-top:20px;">
<div class="row-fluid article_row_fluid">
<div class="span8 contant article_detail_bg">
<h1>Android代码速查,写给新手的朋友们 </h1>
<div class="article_meta">
<div style="margin-bottom: 5px;">
<span class="timestamp">时间&nbsp;2014-04-12 18:08:30
</span>
<span class="from">
<i class="icon-search"></i>
<a href="http://m.open-open.com/m/lib/category/177" class="category">Android开发</a>
<span class="tags">

<a href="http://m.open-open.com/m/lib/tags/Android">Android</a>

</span>
</span>
</div>
</div>
<div class="article_body" id="nei">

0 android 创建按钮<br style="word-wrap:break-word;">
<p>Button button = new Button(this);</p>
<p>&nbsp;</p>
1 android 创建输入框<br style="word-wrap:break-word;">
<p>EditText editText = new EditText(this);</p>
<p>&nbsp;</p>
2 android 创建文本<br style="word-wrap:break-word;">
<p>TextView textView = new TextView(this);</p>
<p>&nbsp;</p>
3 android 设置文本显示内容<br style="word-wrap:break-word;">
TextView textView = new TextView(this);<br style="word-wrap:break-word;">
<p>textView.setText("hello world!");</p>
<p>&nbsp;</p>
4 android 设置文本背景色<br style="word-wrap:break-word;">
TextView textView = new TextView(this);<br style="word-wrap:break-word;">
<p>textView.setBackgroundColor(Color.YELLOW);</p>
<p>&nbsp;</p>
5 android 设置文本颜色<br style="word-wrap:break-word;">
TextView textView = new TextView(this);<br style="word-wrap:break-word;">
<p>textView.setTextColor(Color.YELLOW);</p>
<p>&nbsp;</p>
6 android 设置文本文字大小<br style="word-wrap:break-word;">
TextView textView = new TextView(this);<br style="word-wrap:break-word;">
<p>textView.setTextSize(18);</p>
<p>&nbsp;</p>
7 android 设置输入框宽度<br style="word-wrap:break-word;">
EditText editText = new EditText(this);<br style="word-wrap:break-word;">
<p>editText.setWidth(200);</p>
<p>&nbsp;</p>
8 android 设置输入框为密码框<br style="word-wrap:break-word;">
EditText editText = new EditText(this);<br style="word-wrap:break-word;">
editText.setTransformationMethod(<br style="word-wrap:break-word;">
<p>PasswordTransformationMethod.getInstance());</p>
<p>&nbsp;</p>
9 android 设置输入框为密码框(xml配置)<br style="word-wrap:break-word;">
<p>android:password="true"</p>
<p>&nbsp;</p>
10 android 提示对话框的使用<br style="word-wrap:break-word;">
AlertDialog.Builder builder = new AlertDialog.Builder(this);<br style="word-wrap:break-word;">
builder.setTitle("你好");<br style="word-wrap:break-word;">
builder.setPositiveButton("OK",this);<br style="word-wrap:break-word;">
builder.show()<br style="word-wrap:break-word;">
<p>需实现android.content.DialogInterface.OnClickListener接口</p>
<p>&nbsp;</p>
11 android ListView的使用<br style="word-wrap:break-word;">
ListView listView = new ListView(this);<br style="word-wrap:break-word;">
ArrayList&lt;HashMap&lt;String, Object&gt;&gt; list = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;();<br style="word-wrap:break-word;">

Next
Pg.: 1 2 3 4 5 6 ... 12


Back to home | File page

Subscribe | Register | Login | N