当前位置: 编程技术>移动开发
本页文章导读:
▪取得控件相对屏幕的点击位置 获得控件相对屏幕的点击位置
int[] location = new int[2];imageHead.getLocationOnScreen(location);
......
▪ navigationController 总结 navigationController 小结
//跳转到下一组controller
SelectLevelControllerView *_selectLevelControllerView=[[SelectLevelControllerView alloc] init]; [self.navigationController pushViewController:_selectLevelControllerView animate.........
▪ gallery显示图片替换(手动和自动) gallery显示图片轮换(手动和自动)
1.gallery.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:cacheColorHint="#00000000" android:layout_width="fill.........
[1]取得控件相对屏幕的点击位置
来源: 互联网 发布时间: 2014-02-18
获得控件相对屏幕的点击位置
int[] location = new int[2];
imageHead.getLocationOnScreen(location);
int[] location = new int[2];
imageHead.getLocationOnScreen(location);
[2] navigationController 总结
来源: 互联网 发布时间: 2014-02-18
navigationController 小结
//跳转到下一组controller
SelectLevelControllerView *_selectLevelControllerView=[[SelectLevelControllerView alloc] init];
[self.navigationController pushViewController:_selectLevelControllerView animated:NO];
[_selectLevelControllerView release];
//返回到顶级 controller
[self.navigationController popViewControllerAnimated:NO];
[3] gallery显示图片替换(手动和自动)
来源: 互联网 发布时间: 2014-02-18
gallery显示图片轮换(手动和自动)
1.gallery.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:cacheColorHint="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/gallerylayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- 广告图片 -->
<Gallery android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:spacing="1dp"
android:fadingEdge="none"
/>
<LinearLayout
android:orientation="vertical"
android:layout_gravity="bottom"
android:background="@drawable/boke_titlebg"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextSwitcher
android:id="@+id/TextSwitcher01"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TextSwitcher>
<LinearLayout
android:id="@+id/hintlayout"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
2.代码中添加
autoGallery = new Timer();
autoGallery.schedule(new TimerTask() {
@Override
public void run() {
if (gallerypisition < count - 1) {
gallerypisition = gallerypisition + 1;
} else {
gallerypisition = 0;
}
autoGalleryHandler.sendEmptyMessage(1);
}
}, 5000, 5000);
Handler autoGalleryHandler = new Handler() {
public void handleMessage(Message message) {
super.handleMessage(message);
switch (message.what)
{
case 1:
g.setSelection(gallerypisition);
break;
}
}
};
1.gallery.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:cacheColorHint="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/gallerylayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- 广告图片 -->
<Gallery android:id="@+id/gallery"
android:layout_width="fill_parent"
android:layout_height="160dp"
android:spacing="1dp"
android:fadingEdge="none"
/>
<LinearLayout
android:orientation="vertical"
android:layout_gravity="bottom"
android:background="@drawable/boke_titlebg"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextSwitcher
android:id="@+id/TextSwitcher01"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TextSwitcher>
<LinearLayout
android:id="@+id/hintlayout"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
2.代码中添加
autoGallery = new Timer();
autoGallery.schedule(new TimerTask() {
@Override
public void run() {
if (gallerypisition < count - 1) {
gallerypisition = gallerypisition + 1;
} else {
gallerypisition = 0;
}
autoGalleryHandler.sendEmptyMessage(1);
}
}, 5000, 5000);
Handler autoGalleryHandler = new Handler() {
public void handleMessage(Message message) {
super.handleMessage(message);
switch (message.what)
{
case 1:
g.setSelection(gallerypisition);
break;
}
}
};
最新技术文章: