启动界面

主要有两个功能:
1.加载启动动画
2.判断网络,有者直接进入登陆界面,否则去设置网络

代码较简单,主要采用AlphaAnimation()方法和动画监听器,使一张图片产生渐变动画。在动画启动的时候判断网络,动画结束时完成判断并进入登陆界面。

/*** Created by D&LL on 2016/5/25.* 初始页面加载界面*/
public class SplashActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.splash);ImageView splashimage = (ImageView) findViewById(R.id.splashimage);//透明度渐变动画AlphaAnimation animation = new AlphaAnimation(0.1f, 1.0f);//设置动画时长animation.setDuration(3000);//将组件和动画进行关联splashimage.setAnimation(animation);animation.setAnimationListener(new Animation.AnimationListener() {//动画启动执行@Overridepublic void onAnimationStart(Animation animation) {Toast.makeText(SplashActivity.this, "欢迎使用DeMon制作微博", Toast.LENGTH_LONG).show();//检查并网络的方法Tools.checkNetWork(SplashActivity.this);}//动画结束执行@Overridepublic void onAnimationEnd(Animation animation) {Intent intent = new Intent(SplashActivity.this, LoginActivity.class);startActivity(intent);finish();}//动画重复执行@Overridepublic void onAnimationRepeat(Animation animation) {}});}

使用ConnectivityManager获取系统的连接服务,然后获取代表联网状态的NetWorkInfo对象,获取网络的连接情况,如果没有网络则生成一个AlertDialog引导进行网络设置。该方法位于Tools.java中。

 /*** 设置网络** @param context*/public static void checkNetWork(final SplashActivity context) {if (!NetWorkStatus(context)) {TextView msg = new TextView(context);msg.setText("请设置网络!");AlertDialog.Builder b = new AlertDialog.Builder(context).setIcon(R.drawable.notnet).setTitle("没有可用的网络").setMessage("是否对网络进行设置?");b.setPositiveButton("是", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int whichButton) {//跳转到设置网络界面context.startActivity(new Intent(Settings.ACTION_SETTINGS));}}).setNeutralButton("否", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int whichButton) {dialog.cancel();context.finish();}}).create().show();}}/*** 判断网络状态*/public static boolean NetWorkStatus(Context context) {//获取系统的连接服务ConnectivityManager connect = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);if (connect == null) {return false;} else {// 获取代表联网状态的NetWorkInfo对象,获取网络的连接情况NetworkInfo[] infos = connect.getAllNetworkInfo();if (infos != null) {for (NetworkInfo network : infos) {if (network.getState() == NetworkInfo.State.CONNECTED) {return true;}}}}return false;}

SplashActivity的布局文件splash.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><ImageView
        android:id="@+id/splashimage"android:layout_width="match_parent"android:layout_height="match_parent"android:scaleType="fitXY"android:src="@drawable/splashimage"/><ProgressBar
        style="@android:style/Widget.ProgressBar.Inverse"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:layout_alignParentStart="true"android:layout_gravity="center"android:layout_marginBottom="64dp"android:layout_marginStart="130dp"></ProgressBar>
</RelativeLayout>

登陆界面

此界面只有几个按钮,故合在一条博客里。

微博按钮触发进入到到授权界面

public class LoginActivity extends Activity {private Button  sinalogin;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.login);sinalogin = (Button) findViewById(R.id.sinalogin);sinalogin.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {Intent intent = new Intent(LoginActivity.this, OAuthActivity.class);startActivity(intent);LoginActivity.this.finish();}});}}

布局文件login.xml两个自定义样式的EditText,一个普通按钮(此处纯粹摆设)。只有微博登陆按钮有用。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/background"android:gravity="center_vertical"android:orientation="vertical"android:paddingBottom="@dimen/activity_vertical_margin"android:paddingLeft="@dimen/activity_horizontal_margin"android:paddingRight="@dimen/activity_horizontal_margin"android:paddingTop="@dimen/activity_vertical_margin"><EditText
        android:id="@+id/username"android:layout_width="match_parent"android:layout_height="40dip"android:background="@drawable/bg_edittext"android:ems="10"android:inputType="textPersonName"></EditText><EditText
        android:id="@+id/passworld"android:layout_width="match_parent"android:layout_height="40dip"android:layout_marginTop="20dip"android:background="@drawable/bg_edittext"android:ems="10"android:inputType="textPassword"/><LinearLayout
        android:layout_width="fill_parent"android:layout_height="wrap_content"android:orientation="horizontal"><Button
            android:id="@+id/login"android:layout_width="200dp"android:layout_height="wrap_content"android:layout_marginTop="20dip"android:layout_weight="1"android:text="登录"/><Button
            android:id="@+id/sinalogin"android:layout_width="200dp"android:layout_height="38dp"android:layout_marginTop="20dip"android:layout_weight="1"android:background="@drawable/weibologin"/></LinearLayout>
</LinearLayout>

Android模仿新浪微博(启动界面登陆界面)相关推荐

  1. Android仿新浪微博弹出界面动画,Android仿新浪微博启动界面或登陆界面(1)

    本文为大家分享了Android模仿新浪微博启动界面&登陆界面的具体实现代码,供大家参考,具体内容如下 启动界面 主要有两个功能: 1.加载启动动画 2.判断网络,有者直接进入登陆界面,否则去设 ...

  2. Android模仿淘宝详情页界面

    话不多说-先上效果图: 图1中主要需要实现的效果: 1.轮播图 2.顶部导航栏的渐变 3.顶部导航栏随着滑动的位置选择对应的值以及点击滑动到对应位置 Android模仿淘宝详情页界面文件:url80. ...

  3. Android 简单的账号密码登陆界面(IO流)

    Android 简单的账号密码登陆界面(IO流) 用到了map<String,String> .IO流等. MainActivity代码如下: package com.xh.tx.file ...

  4. 仿新浪微博2014之登陆界面一(sqlite操作)

    上一贴介绍了简单的欢迎界面后,我们进入了登陆界面的设计 由于我使用的是新浪微博的第三方授权登陆,所以并不需要账号输入框和密码输入框 登陆界面有一个新浪微博logo(imageview).用户头像(im ...

  5. centOS6.6虚拟机启动后登陆界面无法显示

    1.图一和图二对比就很明显发现,我的登陆界面不见了(突然断电导致不正常关机,造成图形界面桌面崩溃) 2.解决方法:启动按Ctrl+Alt+f2切换进命令行界面,root账号进入,重新下载图形界面 转载 ...

  6. Android模仿新浪微博(主页微博,评论界面)

    主页微博: 获取当前登录用户及其所关注(授权)用户的最新微博接口:http://open.weibo.com/wiki/2/statuses/friends_timeline 代码详解: 1.异步ge ...

  7. 仿新浪微博2014之登陆界面四(总体功能)

    在前面完成了数据库操作.异步图片加载和缓存.新浪微博认证后,就可以进行登录界面的功能开发了,登录界面功能代码如下: package com.xhq.xweibo.ui;import java.util ...

  8. android模仿唱吧榜单界面,唱吧界面重设计|UI|APP界面|超人不是神- 原创作品 - 站酷 (ZCOOL)...

    1.为什么选择改版唱吧: 在同类K歌软件中,唱吧的用户人群很大,功能比较完善: 但是唱吧的功能比较复杂,视觉设计却不够简洁(分隔线太多,元素与元素的间隔太小等)导致页面略显拥挤: 在交互上,个人认为有 ...

  9. android模仿唱吧榜单界面,仿唱吧UI效果

    这几天想放开歌喉 唱歌 下了唱吧app,发现里面的交互效果 挺好玩的,突然就想写出来 (可能这就是本能吧) 左侧是本地效果,图二是唱吧效果 这里写代码片 这里写图片描述 这里写图片描述 这里写图片描述 ...

  10. android模仿唱吧榜单界面,唱吧上线弹唱新功能 却因界面设计功能相似被指抄袭唱鸭...

    [TechWeb]1月10日消息,日前,有多家媒体报道称,唱吧即将上线弹唱功能,目前正在测试中,并且已经有用户上传弹唱作品.与此同时,唱吧还将正式对外宣布上亿规模的音乐创作者分成计划.不过,有网友发现 ...

最新文章

  1. CLR Via C# 3rd 阅读摘要 -- Chapter 24 – Runtime Serialization
  2. C#操作SQLite数据库时出现“Insufficient parameters supplied to the command”的错误
  3. 利用python对微信云数据库_如何用python看看女神的微信百度云里面有啥?
  4. mysql command line client 目标不对_简单几招提高MySQL安全性
  5. cuda笔记-初始化矩阵及thread,block,grid概念
  6. 【java】SpringBoot新特性 节省百分之95﹪内存占用
  7. Alpha冲刺随笔—:第一天
  8. 【原创】SM4password算法源代码接口具体解释
  9. centOS之jre安装
  10. 禁用win10触摸屏手势_搞机作战室:win10触控板多指触控,手势操作教程
  11. 一个vue项目同时兼容pc和移动端
  12. (NO.00004)iOS实现打砖块游戏(一):素材的制作
  13. Anaconda3+python3.7成功安装dlib-19.19.0库(稀里糊涂)
  14. SQLMap用户常用命令——1
  15. 信息系统项目管理:质量管理
  16. 通过JS定义一个Iframe
  17. c语言程序设计第二版(张磊),C语言程序设计教程(第2版) 教学课件 张磊 第9章 文件程序设计.pdf...
  18. 计算机网络:网络安全
  19. 崩坏3服务器维护2月8号,新版本上线!《崩坏3》2月8日新版本更新内容一览
  20. mysql 嵌套查询性能_mysql SQL优化之嵌套查询-遁地龙卷风

热门文章

  1. 杰奇 v1.7去限制版橙色模板小说源码
  2. 有道云笔记怎么保存html,有道云笔记如何保存网页 有道笔记保存页面教程
  3. 通过windows启动流程分析rootkit的潜在位置
  4. 注意:QQ空间加密并不安全
  5. 字符串模式匹配——BF算法
  6. 【报表福利大放送】100余套报表模板免费下
  7. 解决eccube お名前.com服务器 各种请求链接 https 不生效
  8. 浅谈中国古代服饰纹样中礼制精神的体现
  9. 网络管理(课程总结3)Week12 澳大利亚维多利亚大学VIT1104 Computer Networks
  10. 项目经理成长之路的三个层次