android知识点

如何实现两个页面的切换?
1、Activity的切换
2、通过改变加载控件的配置文件方式——setContentView(R.layout.main);
备注:创建这个加载的配置文件只能在layout目录下,要R这个文件能够识别出,否则这个工程是不能正常跑起来的
第二种方式相当于控件全部重新加载了一遍,因此之前绑定的事件也会随着控件的加载消失,因此这种方式只适合于显示切换,而切换的内容不应该有过多的操作。

 

常用控件的处理

<TableLayout
    	android:layout_width="fill_parent"
    	android:layout_height="wrap_content" 
    	android:collapseColumns="3"
    	android:stretchColumns="1">
	<TableRow>
		<TextView
			android:layout_width="wrap_content" 
			android:layout_height="wrap_content" 
			android:text="@string/sex"
		/>
		<RadioGroup 
			android:id="@+id/sex"
		>
			<RadioButton
				android:id="@+id/sex_boy"
				android:text="@string/boy"
				android:checked="true"
			/>
			<RadioButton
				android:id="@+id/sex_girl"
				android:layout_toRightOf="@id/sex_boy"
				android:text="@string/girl"
			/>
		</RadioGroup>
	</TableRow>
</TableLayout>
<CheckBox
	android:id="@+id/music"
	android:text="@string/music"
	android:layout_width="wrap_content" 
	android:layout_height="wrap_content" 
/>
<EditText
	android:id="@+id/username"
	android:layout_width="fill_parent" 
	android:layout_height="wrap_content" 
/>
<Spinner
	android:id="@+id/marray"
	android:layout_width="wrap_content" 
	android:layout_height="wrap_content" 
	android:layout_toRightOf="@id/label_marray"
	android:paddingLeft="15px"
	android:prompt="@string/marry"
/>

 备注:如果在控件配置文件中没有设定控件的高宽属性,则程序启动将会报错

Eclipse工具介绍——DDMS
1、File Explorer可以查看到SQLite创建的数据库文件
2、使用Log类(android.util.Log)可以自己打log,查看自己弄的

posted @ 2011-12-21 19:38  胖鹅  阅读(199)  评论(0编辑  收藏  举报