Android移动终端开发大作业
更新时间:2023-04-24 17:45:01 阅读量: 实用文档 文档下载
- 安卓移动终端开发大作业推荐度:
- 相关推荐
A n d r o i d移动终端开发
大作业
Company Document number:WTUT-WT88Y-W8BBGB-BWYTT-19998
Android移动终端开发大作业
一、作业要求
●1人一组,独立完成。
●按照个人兴趣方向,自选题目,完成系统。
●在规定的时间里完成系统主体功能,程序比较稳定的运行。
●手机界面要求简洁、美观,功能不能过于简单,应具备一定的实用性。
●至少要3个Activity以上。
●欢迎好的创意作品、实用作品,评分时会适当加分。
●需提交设计报告,设计报告格式见附件,按附件顺序装订(包括评分表)
●大作业成绩从工作量、功能点、创新性、实用性、报告的字数、质量及规范度等方
面的成绩构成
二、注意事项
●压缩包内作业内容包括两部分:
①作业设计说明,word文件。
●可以借鉴网络上的代码,但不可全部照搬。
不许相互抄袭,一旦发现成绩为零。
Android平台移动应用开发
大作业
题目基于Android的新闻浏览软件的
设计与实现
学院信息工程学院专业信息工程班级信息1303 姓名杏允升
指导教师秦珀石2015 年12 月10 日
一、概述
Android应用平台新闻客户端软件是基于Android手机平台,采用Java语言,从网络上的开放的新闻接口获取数据,设计出针对使用Android平台的手机新闻客户端资讯实时掌控的手机应用程序。
Android平台新闻客户端软件的开发可以进一步扩大时事新闻的覆盖面,让广大公众能够随时随地方便且快捷地获取最新的新闻资讯信息,了解新闻时事,本软件的广泛使用,尤其是在传授知识、普及教育方面起着非常重要的作用。
目前市场研究机构Worldpanel发布了全球主要的国家智能手机操作系统在去年Q4内的分布报告,报告指出了谷歌的Android继续保持着增长的势态,但是增幅已经明显放缓了。而在另一个方面,苹果iOS操作系统在全球只能手机市场上均有下滑,个别国家的降幅甚至高达%。最新统计数据中显示,Android操作系统将继续领跑全球市场,包括美国、澳大利亚、中国、意大利、英国、德国、西班牙等所占的市场比例都已经超出50%,并且还将继续呈现上涨的趋势。而在苹果iOS操作系统方面,最大的市场份额所占比的国家依旧是美国,数值为%;紧随美国的则是澳大利亚,数值为%;而在中国方面,市场份额也从%下降到了19%;在意大利,iOS所占的市场份额更是从%猛降至%。
从上面的数据可以看出,Android手机软件的开发具有巨大的发展前景,在Android系统上开发出一款手机新闻客户端软件所支持的用户量也是相比较于其他系统多出很多的。
谷歌的移动平台主管安迪·鲁宾(AndyRubin)表示,跟软件开发合作对象的密切接触正在进行中。Google与开放手机联盟联合开发了Android操作系统,这个联盟由摩托罗
拉、高通、宏达电、中国移动和T-Mobile等在内的多家无线应用和技术的领军企业组成。Google通过与设备制造商、开发商、运营商和其他有关各方结成深层次的合作关系,希望借助建立开放式、标准化的移动移动电话软件平台,在移动产业内形成一个开放性的生态系统,这将是开发Android软件的一个契机,Android平台的开发在将来必定大放异彩。
二、关键技术
1) 使用ViewPager里面添加多张图片配合线程延时实现轮播图的自
没有通过ScheduledExecutorService或Timer定期执行某个任务实现,而是简单的通过handler发送消息去完成一次滚动,在完成一次滚动后发送另外一个delay的滚动消息,如此循环实现。自动滚动部分核心代码如下:
至于ViewPager嵌套引起子ViewPager无法触摸问题是通过在子ViewPager的onTouchEvent中添加
禁止父控件对touch event做intercept解决的。
ViewPager滑动速度的设置是通过反射的方式重新设置ViewPager的Scroller,改变Scroller的startScroll的间隔时间完成的。调用setScrollDurationFactor(double)即可。
2、使用
(1) 引入公共库
引入Android Auto Scroll ViewPager@Github作为你项目的library(如何拉取代码及添加公共库)。
(2) 调用
仅需简单两步:
a. 布局定义
代替一般的ViewPager定义
b. 启动ViewPager自动滚动
startAutoScroll() 启动自动滚动
stopAutoScroll() 停止自动滚动
3、设置
setInterval(long) 设置自动滚动的间隔时间,单位为毫秒
setDirection(int) 设置自动滚动的方向,默认向右
setCycle(boolean) 是否自动循环轮播,默认为true
setScrollDurationFactor(double) 设置ViewPager滑动动画间隔时间的倍率,达到减慢动画或改变动画速度的效果
setStopScrollWhenTouch(boolean) 当手指碰到ViewPager时是否停止自动滚动,默认为true
setSlideBorderMode(int) 滑动到第一个或最后一个Item的处理方式,支持没有任何操作、轮播以及传递到父View三种模式
setBorderAnimation(boolean) 设置循环滚动时滑动到从边缘滚动到下一个是否需要动画,默认为true
4、其他
(1)指示器,圆形或是方形指示器请配合ViewPagerIndicator使用
(2)无限循环,如果希望在最后一张继续播放第一张而不是退回到第一张,请参考,注意这个特性不能和 ViewPagerIndicator 使用
2)使用viewpager结合ViewPageIndicator进行新闻类别的分类切换,可点击切换也可以滑动切换。
1. ViewPager Indicator的Library
查看Viewpager Indicator的Library代码,可以看到此项目的设计思想:
首先定义了一个PageIndicator接口,它里面定义了最重要和基本的indicator表现出的一些方法:
首先一个indicator必须要与一个ViewPager关联在一起,所以它提供了一个se tViewPager方法。它扩展了接口,表示接管了ViewPager的Pager改变时的监听处理,
这也是为什么为ViewPager设置OnPageChangeListener监听器时不能设置在ViewPager上而必须设置在
indicator上的原因。
还有一个notifyDataSetChanged通知方法,表示为这个ViewPager提供Vie w(一般是Fragment)的 Adapter 里面的数据集发生变化时,执行的动作,这里可增加相关的逻辑。
2. Viewpager Indicator的实现类
然后再看下Viewpager Indicator的实现类,共有6个,由6个类分别实现,它们分别为:
小圆圈类型的带图标类型的
小横线类型的,距离屏幕最下边端有一定的距离。
标签类型的(Tab)
标题类型的,与标签类型的有点像,但它当前的标题页的左/右边的标题会卷起,即往两端缩进去。
屏幕底部小横线类型的,并且会占满整行。
3. Viewpager Indicator随附带的Demo
Demo项目的设计
项目由一个ListSamples的ListActivity入口,它主要用作组装所有的子indicator的列表。
,所有ViewPager上真正显示的视图。,所有ViewPager里的Adapter,为ViewPager生成TestFragment。
,所有的indicator的显示,一个类显示一种使用方法或特性
2)使用viewpager结合ViewPageIndicator进行新闻类别的分类切换,可点击切换也可以滑动切换。
3)使用Gson对新闻数据的json字符串进行解析显示到listview上
需要使用jar包
fastjson或gson这两个jar包。
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class TabSlidingIndicator extends HorizontalScrollView
{
public interface IconTabProvider
{
public int getPageIconResId(int position);
}
etDisplayMetrics();
scrollOffset = (int) , scrollOffset, dm);
indicatorHeight = (int) , indicatorHeight, dm);
underlineHeight = (int) , underlineHeight, dm);
piderPadding = (int) , piderPadding, dm);
tabPadding = (int) , tabPadding, dm);
piderWidth = (int) , piderWidth, dm);
tabTextSize = (int) , tabTextSize, dm);
etConfiguration().locale;
}
}
public void setViewPager(ViewPager pager)
{
= pager;
if () == null) { throw new IllegalStateException("ViewPager does not have adapter instance."); }
(pageListener);
notifyDataSetChanged();
}
public void setOnPageChangeListener(OnPageChangeListener listener)
{
= listener;
}
public void notifyDataSetChanged()
{
();
tabCount = ().getCount();
for (int i = 0; i < tabCount; i++)
{
if () instanceof IconTabProvider)
{
addIconTab(i, ((IconTabProvider) ()).getPageIconResId(i));
}
else
{
addTextTab(i, ().getPageTitle(i).toString());
}
}
updateTabStyles();
getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onGlobalLayout()
{
{
getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
else
{
getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
currentPosition = ();
scrollToChild(currentPosition, 0);
if (pageListener != null)
{
(currentPosition);
}
}
});
}
private void addTextTab(final int position, String title)
{
TextView tab = new TextView(getContext());
(title);
;
();
addTab(position, tab);
}
private void addIconTab(final int position, int resId)
{
ImageButton tab = new ImageButton(getContext());
(resId);
addTab(position, tab);
}
private void addTab(final int position, View tab)
{
(true);
(new OnClickListener() {
@Override
public void onClick(View v)
{
(position);
}
});
(tabPadding, 0, tabPadding, 0);
(tab, position, shouldExpand expandedTabLayoutParams : defaultTabLayoutParams);
}
private void updateTabStyles()
{
for (int i = 0; i < tabCount; i++)
{
View v = (i);
(tabBackgroundResId);
if (v instanceof TextView)
{
TextView tab = (TextView) v;
, tabTextSize);
(tabTypeface, tabTypefaceStyle);
oString().toUpperCase(locale));
}
}
}
}
}
private void scrollToChild(int position, int offset)
{
if (tabCount == 0) { return; }
int newScrollX = (position).getLeft() + offset;
if (position > 0 || offset > 0)
{
newScrollX -= scrollOffset;
}
if (newScrollX != lastScrollX)
{
lastScrollX = newScrollX;
scrollTo(newScrollX, 0);
}
}
@Override
protected void onDraw(Canvas canvas)
{
(canvas);
if (isInEditMode() || tabCount == 0) { return; }
final int height = getHeight();
etWidth()));
invalidate();
if (delegatePageListener != null)
{
(position, positionOffset, positionOffsetPixels);
}
}
@Override
public void onPageScrollStateChanged(int state)
{
if (state ==
{
scrollToChild(), 0);
}
if (delegatePageListener != null)
{
(state);
}
}
@Override
public void onPageSelected(int position)
{
if (delegatePageListener != null)
{
(position);
}
updateTabStyles();
}
}
public void setIndicatorColor(int indicatorColor)
{
= indicatorColor;
invalidate();
}
public void setIndicatorColorResource(int resId)
{
= getResources().getColor(resId);
invalidate();
}
public int getIndicatorColor()
{
return ;
}
public void setIndicatorHeight(int indicatorLineHeightPx) {
= indicatorLineHeightPx;
invalidate();
}
public int getIndicatorHeight()
{
return indicatorHeight;
}
public void setUnderlineColor(int underlineColor)
{
= underlineColor;
invalidate();
}
public void setUnderlineColorResource(int resId)
{
= getResources().getColor(resId);
invalidate();
}
public int getUnderlineColor()
{
return underlineColor;
}
public void setDividerColor(int piderColor)
{
= piderColor;
invalidate();
}
public void setDividerColorResource(int resId)
{
= getResources().getColor(resId);
invalidate();
}
public int getDividerColor()
{
return piderColor;
}
public void setUnderlineHeight(int underlineHeightPx) {
= underlineHeightPx;
invalidate();
}
public int getUnderlineHeight()
{
return underlineHeight;
}
public void setDividerPadding(int piderPaddingPx) {
= piderPaddingPx;
invalidate();
}
public int getDividerPadding()
{
return piderPadding;
}
public void setScrollOffset(int scrollOffsetPx)
{
= scrollOffsetPx;
invalidate();
}
public int getScrollOffset()
{
return scrollOffset;
}
public void setShouldExpand(boolean shouldExpand) {
= shouldExpand;
requestLayout();
}
public boolean getShouldExpand()
{
return shouldExpand;
}
public boolean isTextAllCaps()
{
return textAllCaps;
}
public void setAllCaps(boolean textAllCaps)
{
= textAllCaps;
}
public void setTextSize(int textSizePx)
{
= textSizePx;
updateTabStyles();
}
public int getTextSize()
{
return tabTextSize;
}
public void setTextColor(int textColor)
{
= textColor;
updateTabStyles();
}
public void setTextColor(int textNormalColor, int textSelectedColor) {
= textNormalColor;
= textSelectedColor;
updateTabStyles();
}
public void setTextColorResource(int resId)
{
= getResources().getColor(resId);
updateTabStyles();
}
public int getTextColor()
{
return tabTextColor;
}
public void setTypeface(Typeface typeface, int style)
{
= typeface;
= style;
updateTabStyles();
}
public void setTabBackground(int resId)
{
= resId;
}
public int getTabBackground()
{
return tabBackgroundResId;
}
public void setTabPaddingLeftRight(int paddingPx)
{
= paddingPx;
updateTabStyles();
}
public int getTabPaddingLeftRight()
{
return tabPadding;
}
@Override
public void onRestoreInstanceState(Parcelable state)
{
SavedState savedState = (SavedState) state;
());
currentPosition = ;
requestLayout();
}
@Override
public Parcelable onSaveInstanceState()
{
Parcelable superState = ();
SavedState savedState = new SavedState(superState);
= currentPosition;
return savedState;
}
static class SavedState extends BaseSavedState
{
int currentPosition;
public SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
currentPosition = ();
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
(dest, flags);
(currentPosition);
}
public static final
@Override
public SavedState createFromParcel(Parcel in)
{
return new SavedState(in);
}
@Override
public SavedState[] newArray(int size)
{
return new SavedState[size];
}
};
}
}
代码3:
*
* Licensed under the Apache License, Version (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class BitmapUtils implements TaskHandler {
private boolean pauseTask = false;
private boolean cancelAllTask = false;
private final Object pauseTaskLock = new Object();
private Context context;
private BitmapGlobalConfig globalConfig;
private BitmapDisplayConfig defaultDisplayConfig;
etDrawable(resId));
return this;
}
public BitmapUtils configDefaultLoadingImage(Bitmap bitmap) {
(new BitmapDrawable(), bitmap));
return this;
}
public BitmapUtils configDefaultLoadFailedImage(Drawable drawable) {
(drawable);
return this;
}
public BitmapUtils configDefaultLoadFailedImage(int resId) {
().getDrawable(resId));
return this;
}
public BitmapUtils configDefaultLoadFailedImage(Bitmap bitmap) {
(new BitmapDrawable(), bitmap));
return this;
}
public BitmapUtils configDefaultBitmapMaxSize(int maxWidth, int maxHeight) { (new BitmapSize(maxWidth, maxHeight));
return this;
}
public BitmapUtils configDefaultBitmapMaxSize(BitmapSize maxSize) {
(maxSize);
return this;
}
public BitmapUtils configDefaultImageLoadAnimation(Animation animation) {
(animation);
return this;
}
public BitmapUtils configDefaultAutoRotation(boolean autoRotation) {
(autoRotation);
return this;
}
public BitmapUtils configDefaultShowOriginal(boolean showOriginal) {
(showOriginal);
return this;
}
public BitmapUtils configDefaultBitmapConfig config) {
(config);
正在阅读:
Android移动终端开发大作业04-24
新疆昌吉回族自治州奇台县中考语文二模试卷05-29
南开18秋学期(1703)《绩效与薪酬管理》在线作业_ss05-25
进一步完善“乡财县管”改革工作的思考07-12
材料力学填空与判断题解11-17
太上老君说常清静经清静经释义-黄庭禅创办人 张庆祥 着06-14
林场经营所上半年工作总结与下半年工作打算03-12
交互英语ULearning答案Academic Connections 2UNIT 7 Literature08-24
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- 终端
- 作业
- Android
- 移动
- 开发
- A318-321飞机飞行手册
- 水滴系列八年级英语上册Unit6I’mgoingtostudycomputersciencepe
- 详细中外劳务合同模板
- 钢结构厂房拆装施工方案
- 金大师黄金交易从业人员培训 竞价交易规则11上课讲义
- 合肥地铁2标地下连续墙施工方案
- 心理疗法:折衷的咨询和治疗
- 2017版中国融资租赁行业现状分析与发展趋势研究报告
- 教育实习个人工作总结.doc
- 幼儿园小班儿歌教案《三条小鱼游》
- 幕墙工程施工组织设计
- 人教新目标版七年级英语上册Unit6DoyoulikebananasPeriod1教案
- 长沙芙蓉南路绿地商业规划设计方案
- 初级会计实务——交易性金融资产练习题及答案
- 会计报表各科目的中英文对照
- 汽车维修工程期末试卷及答案
- 2011年中考复习中国四大名著索引
- 高考物理牛顿运动定律精编习题含解析
- 高三生物一轮复习:专题18 植物的激素调节
- 法理学考前辅导(新)