- 浏览: 28425 次
最新评论
文章列表
private void call() {
System.out.println("拨号");
// 1.首先取出EditText的号码
editText = (EditText) findViewById(R.id.number);
Intent intent = new Intent();
String number = editText.getText().toString();// 得到电话号码
// 根据号码拨打电话
intent.setAction(Intent.ACTION_CALL);// 指定Intent ...
print '{0} is {1}:{2}'.format('123',1,3)
str='dick'
score=80
print '%s score is %d'%(str,score)
class Person(object):#(object),表示,没有父类
def __init__(self, name, age):#构造函数,其中self,代码对象自身
self.name = name
self.age = age
def print_message(self):
print self.age, self.name
class Student(Person):#Student继承Person
def __init__(self, name, age, score):
...
def func(*args):#传参(元组)
print args
print type(args)
func(1, 2, 2, 33)
func('12', 'qw')
def func2(**args):#传参(字典)
print args
print type(args)
func2(a='dick', a2=2, a3=3, a4='1234qwer')
Intent对象的基本概念
是安卓的应用程序组件
Intent的重要内容action(动作)和data(数据)
========================
Intent对象的基本使用方法
================
使用Intent在Activity之间传递数据的方法
使用putExtra()系列方法,向Intent对象,存储数据
使用getxxxExtra()系列方法,从Intent对象当中,取出数据
//第一个activity,放置数据
public void onClick(View ...
什么是生命周期
就好比人,儿童阶段(睡觉,吃,玩),少年阶段(睡觉,吃,学习),成人阶段(工作,结婚),都要做这个阶段要做的事情
Activity,从创建到销毁,中间做了什么事情,这就是它的生命周期
那些生命周期的函数onCreate,onStart,完全由安卓的操作系统自己调用,不是程序员自己调用
==================
一个无聊的例子
生命周期成对出现:
onCreat,onDestory
onStart,onStop
onResume,onPause
public class MainAc ...
Activity生命周期
如何定义多个Activity
1.定义一个类,继承Activity
2.在res的layout,新建一个xml的布局文件
3.在该类当中,复写Activity的OnCreate方法
在方法中,调用setContentView,设置xml的布局文件
4.在AndroidMannifest. ...
进度条 ProgressBar
===============
进度条的主要属性
最大值max;
当前进度progress;
次要进度的值SecondrayProgress
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal&qu ...
TimePicker,时间控件
相关,监听器OnTimeChangedListener,监听用户修改时间
======================
DatePicker,日期控件
DatePicker的监听器,必须要在对话框Dialog才能用
=================
AnalogClock控件,模拟时钟,开发不大用
RelativeLayout相对布局2
对齐到控件的基准线
基准线,baseline,为了保证印刷字母整齐(英文书写),而划定的线
=================
与父控件的四个边缘对齐
android:layout_alignParentLeft="true" //对齐到父控件的左边
android:layout_alignParentRight="true" //对齐到父控件的右边
android:layout_alignParentTop="true" ...
RelativeLayout相对布局
所谓相对布局,即第二个控件的摆放,为第一个控件的相对位置
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:text="第一个" ...
图片视图ImageView
1.在XML中使用<ImageView/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/inter" //图片存放在res/drawable-hdpi
...
单选按钮RadioButton
单选分组RadioGroup
每个RadioGroup,就是一个分组,一个分组里,只有一个单选按钮RadioButton
1.XML文科
<RadioGroup/> <RadioButton/>
<RadioButton/>是<RadioGroup/>的子标签
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
...
多选按钮CheckBox
1.在XML文件中,使用<CheckBox/>标签
<CheckBox
android:id="@+id/eat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="吃饭"
/>
<CheckBox
an ...
设置控件高度,宽度的时候,要用dp
android:layout_width="100dp"
设置字体的时候,要用sp
android:textSize="10sp"
=============
控件样式,内边距和外边距
外边距//两个控件之间的距离
android:layout_margin="30dp"
内边距//自身控件内边框和内容距离
android:padding="20dp"