Android常用控件
TextView 显示文本框 EditView 编辑文本框 Spinner 下拉列表 Button 按钮
CheckBox 复选框 ImageButton 图片按钮 RadioButton 单选按钮 ToggleButton 开关按钮
RadioGroup 按钮组 DatePicker 日期选择器 TimePicker 时间选择器 GridView 网格显示框
ListView 列表显示框 ProgressBar 进度条 SeekBar 可拖动进度条 ImageView 图片显示
ImageSwitcher 图片显示 Gallery 图片浏览 WebView 网页窗口 AlertDiaLog 对话框
ScrollView 滚动屏幕 ViewPager 左右划屏 ViewFlipper 自动屏幕切换 Notification 通知栏信息
AutoCompleteTextView 单个动态自动匹配文本框 MultiAutoCompleteTextView 多个动态自动匹配文
------------------------------------------------------------------------ 分割线 -------------------------------------------------------------------------
ViewPager 页面切换
mPager.setPageTransformer(true, new PageTransformer);页面切换动画
适配器:
PagerAdapter
FragmentAdapter
PagerAdapter四个方法
getCount() 获取数量
isViewFromObject(View view, Object object) 判断View == Object
instantiateItem(ViewGroup container, int position) 创建页面
destroyItem(ViewGroup container, int position, Object object) 销毁页面
事件监听:
addOnPageChangeListener(new ViewPager.OnPageChangeListener();
------------------------------------------------------------------------ 分割线 -------------------------------------------------------------------------
Notification 通知栏消息
示例:
int notification_ID = 0;
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(this);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setTicker("新消息");
builder.setContentTitle("Hacra");
builder.setContentText("Hello World");
builder.setWhen(System.currentTimeMillis());
builder.setDefaults(Notification.DEFAULT_ALL);
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
builder.setContentIntent(pendingIntent);
builder.setAutoCancel(true);
Notification notification = builder.build();manager.notify(notification_ID, notification);