前不久把《Android开发入门教程》看完,并手敲了大部分的示例代码,对android有了个初步的了解,于是在网上找了个不错的项目(新浪微博)开发视频,计划在在接下来的一个月内把这套视频学习完并做好笔记。
第一个视频的任务是完成Logo界面。
首先写一个logo.xml布局文件
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main_bg"
android:gravity="center"
>
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo_bg"
/>
</LinearLayout>
接下来为Logo动画
package haiyang.project.iweibo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.*;
import android.view.animation.*;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
public class LogoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//取消标题
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//取消状态栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//以上取消标题及取消状态栏需在此前完成,因为一旦调用此方法后就渲染完成,再无法改变
setContentView(R.layout.logo);
ImageView imageLogo=(ImageView) this.findViewById(R.id.img_logo);
AlphaAnimation animation=new AlphaAnimation(0.0f, 1.0f);//跳转动画,从完全透明到完全不透明
animation.setDuration(3000);//动画持续的时间
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
//在Logo动画完成时,跳转到登录界面
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
Intent intent=new Intent(LogoActivity.this,LoginActivity.class);
//从Logo页面跳到登录页面
startActivity(intent);
}
});
imageLogo.setAnimation(animation);
}
}
补充:
关于android Animation动画效果介绍,更详细的内容可以参考:http://bbs.droidstouch.com/thread-56-1-1.html
关于全屏的设置,Android 有两种方式:
第一种方式:在protected void onCreate(Bundle savedInstanceState) 里面的this.setContentView() 之前加入以上代码中注释处的代码。
第二种方式:
①在res/values 目录创建个theme.xml 文件(这个文件注主要用来放样式的),文件内容:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- name 是Style的名称,parent 继承那个父类样式 -->
<style name="theme_fullScreen" parent="android:Theme.Black">
<item name="android:windowNoTitle">true</item> <!-- 设置无标题 -->
<item name="android:windowFullscreen">?android:windowNoTitle</item> <!-- 是否填充慢屏幕,引用android:windowNoTitle 的值 -->
</style>
</resources>
②在 AndroidManifest.xml 使用:
<activity android:name=".LoginActivity" android:theme="@style/theme_fullScreen"/>
这样就可以完成Android的全屏设置。
登录界面的操作(待后续学习)
package haiyang.project.iweibo;
import android.app.Activity;
import android.os.Bundle;
public class LoginActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
}
}
添加这个java文件时,注意要在AndroidManifest.xml中的<application />下添加<activityandroid:name=".LoginActivity"/>
此视频资料来自:http://bbs.droidstouch.com/forum-53-1.html 有兴趣的可以一起去学习。
分享到:
相关推荐
教程名称:新浪微博Android客户端开发视频教程(36讲)课程目录:【】新浪微博Android客户端介绍【】新浪微博Android客户端相关资料【】新浪微博Android开发视频教程10、用户登录1【】新浪微博Android开发视频教程11...
本科毕业设计-----新浪微博android客户端的实现
一个新浪微博android客户端的示例程序源代码
教程名称: 新浪微博Android版实例开发视频教程【】3G手机Android应用新浪微博:发布01-开发概述【】3G手机Android应用新浪微博:发布02-下载微博sdk【】3G手机Android应用新浪微博:发布03-微博客户端主架构【】3G...
新浪微博Android客户端的源码,很不错的,希望对大家有所帮助
新浪微博Android客户端代码,没有用官方的SDK,理解起来容易点,希望对大字有帮助
新浪微博android客户端新浪微博android客户端新浪微博android客户端新浪微博android客户端新浪微博android客户端新浪微博android客户端
疯狂软件_疯狂Java_李韩飞老师_Android项目_新浪微博Android客户端开发
Android新浪微博Android客户端.zip
Android 新浪微博Android客户端.rar
新浪微博Android客户端.rar
新浪微博android客户端视频教程36源码
Android 新浪微博Android客户端.zip项目安卓应用源码下载Android 新浪微博Android客户端.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
android新浪微博2.4.0客户端android新浪微博2.4.0客户端android新浪微博2.4.0客户端android新浪微博2.4.0客户端
新浪微博客户端 android平台新浪微博客户端 android平台新浪微博客户端 android平台新浪微博客户端 android平台新浪微博客户端 android平台
DIY 新浪微博Android客户端 ----用Android手机发送来自iPhone的微博
Android源码——新浪微博Android客户端.zip
Android源码——新浪微博Android客户端.7z
Android 新浪微博客户端