布局控件篇:
ScrollView:为控件或者布局添加滚动条
android:layout_marginTop:20px距离上方组件的距离,px代表像素点
android:padding="5dip" 其中dips=(pixs*160)/densityDpi
selector是在文件夹drawable中进行定义的xml文件:
主要定义控件在pressed,selected,focused以及平常状态下的属性。
使用CursorTreeAdapter填充ExpandableListActivity
1.继承cursorTreeAdapter类。
2.实现bindGroupView()[绑定组上的数据]
newGroupView() [设置组上的布局]
getChildrenCursor() [返回子控件的数据]
newChildView() [设置子控件上的布局]
bindChildView() [绑定子控件上的数据]
3.调用setListAdapter(cursorTreeAdapter)填充ExpandableListActivity。
PopupWindow的使用:
1.初始化。调用布局文件显示popupwindow的布局。
view = this.getLayoutInflater().inflate(R.layout.popup_window, null);
pop = new PopupWindow(view, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
2.在控件v下方显示popupwindow
pop.showAsDropDown(v);
ScrollView:为控件或者布局添加滚动条
android:layout_marginTop:20px距离上方组件的距离,px代表像素点
android:padding="5dip" 其中dips=(pixs*160)/densityDpi
selector是在文件夹drawable中进行定义的xml文件:
主要定义控件在pressed,selected,focused以及平常状态下的属性。
bg_selector.xml文件
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/listlayoutsample12xml_press_image" />
<item
android:state_selected="true"
android:drawable="@drawable/listlayoutsample12xml_focus_image" />
<item
android:state_focused="true"
android:drawable="@drawable/listlayoutsample12xml_focus_image" />
<item
android:drawable="@drawable/listlayoutsample12xml_bg_image" />
</selector>
在布局文件中使用它
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="@drawable/bg_selector"
android:paddingRight="13.33dp"
android:layout_height="65.33dp"
android:paddingLeft="31.9dp"
android:gravity="center_vertical">
</LinearLayout>
使用CursorTreeAdapter填充ExpandableListActivity
1.继承cursorTreeAdapter类。
2.实现bindGroupView()[绑定组上的数据]
newGroupView() [设置组上的布局]
getChildrenCursor() [返回子控件的数据]
newChildView() [设置子控件上的布局]
bindChildView() [绑定子控件上的数据]
3.调用setListAdapter(cursorTreeAdapter)填充ExpandableListActivity。
PopupWindow的使用:
1.初始化。调用布局文件显示popupwindow的布局。
view = this.getLayoutInflater().inflate(R.layout.popup_window, null);
pop = new PopupWindow(view, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
2.在控件v下方显示popupwindow
pop.showAsDropDown(v);