package com.android.testUI;
import java.util.Calendar;
import java.util.Date;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.GestureDetector.OnGestureListener;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
public class TestUIActivity extends Activity implements OnGestureListener, OnTouchListener {
private TextView date_TextView;
private ImageButton set_ImageButton, regist_ImageButton, login_ImageButton;
private ViewFlipper viewFlipper;
private boolean showNext = true;
private boolean isRun = true;
private int currentPage = 0;
private final int SHOW_NEXT = 0011;
private static final int FLING_MIN_DISTANCE = 50;
private static final int FLING_MIN_VELOCITY = 0;
private GestureDetector mGestureDetector;
private LinearLayout home_img_bn_Layout, style_img_bn_layout, cam_img_bn_layout, shopping_img_bn_layout, show_img_bn_layout;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
date_TextView = (TextView) findViewById(R.id.home_date_tv);
date_TextView.setText(getDate());
set_ImageButton = (ImageButton) findViewById(R.id.title_set_bn);
set_ImageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
toastInfo("设置属性");
}
});
regist_ImageButton = (ImageButton) findViewById(R.id.home_bn_regist);
regist_ImageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
toastInfo("注册按钮");
}
});
login_ImageButton = (ImageButton) findViewById(R.id.home_bn_login);
login_ImageButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
toastInfo("登录按钮");
}
});
home_img_bn_Layout = (LinearLayout) findViewById(R.id.bottom_home_layout_ly);
home_img_bn_Layout.setOnClickListener(clickListener_home);
style_img_bn_layout = (LinearLayout) findViewById(R.id.bottom_style_layout_ly);
style_img_bn_layout.setOnClickListener(clickListener_style);
cam_img_bn_layout = (LinearLayout) findViewById(R.id.bottom_cam_layout_ly);
cam_img_bn_layout.setOnClickListener(clickListener_cam);
shopping_img_bn_layout = (LinearLayout) findViewById(R.id.bottom_shopping_layout_ly);
shopping_img_bn_layout.setOnClickListener(clickListener_shopping);
show_img_bn_layout = (LinearLayout) findViewById(R.id.bottom_show_layout_ly);
show_img_bn_layout.setOnClickListener(clickListener_show);
viewFlipper = (ViewFlipper) findViewById(R.id.mViewFliper_vf);
mGestureDetector = new GestureDetector(this);
viewFlipper.setOnTouchListener(this);
viewFlipper.setLongClickable(true);
viewFlipper.setOnClickListener(clickListener);
displayRatio_selelct(currentPage);
MyScrollView myScrollView = (MyScrollView) findViewById(R.id.viewflipper_scrollview);
myScrollView.setOnTouchListener(onTouchListener);
myScrollView.setGestureDetector(mGestureDetector);
thread.start();
}
private OnClickListener clickListener = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
toastInfo("点击事件");
}
};
private OnTouchListener onTouchListener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
return mGestureDetector.onTouchEvent(event);
}
};
Handler mHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
switch (msg.what) {
case SHOW_NEXT:
if (showNext) {
showNextView();
} else {
showPreviousView();
}
break;
default:
break;
}
}
};
private String getDate(){
Date date = new Date();
Calendar c = Calendar.getInstance();
c.setTime(date);
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
int w = c.get(Calendar.DAY_OF_WEEK) - 1 ;
if (w < 0) {
w = 0;
}
String mDate = c.get(Calendar.YEAR)+"年" + c.get(Calendar.MONTH) + "月" + c.get(Calendar.DATE) + "日 " + weekDays[w];
return mDate;
}
private OnClickListener clickListener_home = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
home_img_bn_Layout.setSelected(true);
style_img_bn_layout.setSelected(false);
cam_img_bn_layout.setSelected(false);
shopping_img_bn_layout.setSelected(false);
show_img_bn_layout.setSelected(false);
Intent intent = new Intent();
intent.setClass(TestUIActivity.this, MyActivity.class);
intent.putExtra("clickble", true);
startActivity(intent);
home_img_bn_Layout.setSelected(false);
}
};
private OnClickListener clickListener_style = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
home_img_bn_Layout.setSelected(false);
style_img_bn_layout.setSelected(true);
cam_img_bn_layout.setSelected(false);
shopping_img_bn_layout.setSelected(false);
show_img_bn_layout.setSelected(false);
toastInfo("点击我的家有跳转");
}
};
private OnClickListener clickListener_cam = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
home_img_bn_Layout.setSelected(false);
style_img_bn_layout.setSelected(false);
cam_img_bn_layout.setSelected(true);
shopping_img_bn_layout.setSelected(false);
show_img_bn_layout.setSelected(false);
toastInfo("点击我的家有跳转");
}
};
private OnClickListener clickListener_shopping = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
home_img_bn_Layout.setSelected(false);
style_img_bn_layout.setSelected(false);
cam_img_bn_layout.setSelected(false);
shopping_img_bn_layout.setSelected(true);
show_img_bn_layout.setSelected(false);
toastInfo("点击我的家有跳转");
}
};
private OnClickListener clickListener_show = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
home_img_bn_Layout.setSelected(false);
style_img_bn_layout.setSelected(false);
cam_img_bn_layout.setSelected(false);
shopping_img_bn_layout.setSelected(false);
show_img_bn_layout.setSelected(true);
toastInfo("点击我的家有跳转");
}
};
@Override
public boolean onDown(MotionEvent e) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
// TODO Auto-generated method stub
Log.e("view", "onFling");
if (e1.getX() - e2.getX()> FLING_MIN_DISTANCE
&& Math.abs(velocityX) > FLING_MIN_VELOCITY ) {
Log.e("fling", "left");
showNextView();
showNext = true;
// return true;
} else if (e2.getX() - e1.getX() > FLING_MIN_DISTANCE
没有合适的资源?快使用搜索试试~ 我知道了~
安卓UI组件知识与界面设计
共1759个文件
class:517个
png:380个
xml:260个
4星 · 超过85%的资源 需积分: 13 39 下载量 113 浏览量
2013-06-29
12:50:12
上传
评论 1
收藏 8.56MB ZIP 举报
温馨提示
资源包括丰富的UI组件介绍,每个组件都有源码,还有一些漂亮的界面设计,杜宇初学者是非常好的学习资料。
资源推荐
资源详情
资源评论
收起资源包目录
安卓UI组件知识与界面设计 (1759个子文件)
resources.ap_ 155KB
resources.ap_ 154KB
resources.ap_ 154KB
resources.ap_ 131KB
resources.ap_ 126KB
resources.ap_ 100KB
resources.ap_ 85KB
resources.ap_ 85KB
resources.ap_ 65KB
resources.ap_ 58KB
resources.ap_ 54KB
resources.ap_ 49KB
resources.ap_ 48KB
resources.ap_ 38KB
resources.ap_ 31KB
resources.ap_ 31KB
resources.ap_ 31KB
resources.ap_ 31KB
resources.ap_ 30KB
resources.ap_ 30KB
resources.ap_ 30KB
resources.ap_ 27KB
resources.ap_ 25KB
resources.ap_ 24KB
resources.ap_ 22KB
resources.ap_ 18KB
resources.ap_ 18KB
resources.ap_ 18KB
resources.ap_ 17KB
resources.ap_ 16KB
resources.ap_ 16KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
resources.ap_ 15KB
GridViewTest.apk 160KB
SeekBarTest.apk 157KB
RatingBarTest.apk 157KB
UIMainDemo.apk 143KB
testUI.apk 140KB
MixView.apk 103KB
PopupWindowTest.apk 89KB
MockDialog.apk 88KB
SlidingMenuDemo.apk 80KB
ButtonTest.apk 61KB
MyWeiXin.apk 59KB
ActivityMenu.apk 58KB
CheckableMenu.apk 53KB
CustomListDialog.apk 43KB
LoginDialog.apk 35KB
MultiChoiceDialog.apk 35KB
SingleChoiceDialog.apk 34KB
DialogTest.apk 34KB
ListDialog.apk 34KB
ContextMenuTest.apk 34KB
ToastTest.apk 34KB
miniTwitterLoginDemo.apk 31KB
9PatchTest.apk 28KB
SimpleAdapterTest.apk 28KB
ExpandableListViewTest.apk 26KB
MenuListener.apk 23KB
MenuTest.apk 22KB
ProgressBarTest.apk 21KB
RelativeLayoutTest.apk 21KB
ArrayAdapterList.apk 19KB
ProgressDialog.apk 19KB
DateDialog.apk 19KB
ChooseDate.apk 19KB
TableLayoutTest.apk 19KB
SpinnerTest2.apk 18KB
ScrollViewTest.apk 18KB
TableLayoutTest.apk 18KB
ChronometerTest.apk 18KB
CustomView.apk 18KB
TitleProgressBar.apk 18KB
TextViewTest2.apk 18KB
LinearLayoutTest.apk 18KB
TextViewTest.apk 18KB
CheckButtonTest.apk 18KB
SpinnerTest.apk 17KB
ListActivityTest.apk 17KB
AbsoluteLayoutTest.apk 17KB
ClockTest.apk 17KB
jarlist.cache 120B
jarlist.cache 120B
jarlist.cache 120B
jarlist.cache 120B
jarlist.cache 120B
共 1759 条
- 1
- 2
- 3
- 4
- 5
- 6
- 18
资源评论
- xman2003792014-02-10很不错,适合新手
- xiaorenwuzyh2013-11-23可以看看,对初学者有帮助
- bailiju2014-07-13资源有些参考价值,对于初学者比较有用。
yxnouse
- 粉丝: 17
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功