android 屏幕测试程序 测试R G B三色 和 全黑, 全白5种状态
2012-08-08 07:22
411 查看
1.布局文件:activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:id="@+id/myText"/>
</RelativeLayout>
2.Activity视图文件:
package com.wh.lcdtest;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
/**
* @author wh
* @Date 2012-08-07
* @version V0.0
*/
public class MainActivity extends Activity implements OnClickListener{
TextView myTextView;
int flag;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myTextView = (TextView) findViewById(R.id.myText);
myTextView.setText("欢迎使用屏幕测试程序!!请点击屏幕开始测试!!");
myTextView.setTextColor(Color.WHITE);
myTextView.setOnClickListener(this);
flag=1;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void onClick(View view){
String mStr="LCD TEST!!";
System.out.println(mStr);
myTextView.setText("");
flag = flag%5;
switch(flag)
{
case 0:
myTextView.setBackgroundColor(Color.WHITE); break;
case 1:
myTextView.setBackgroundColor(Color.RED); break;
case 2:
myTextView.setBackgroundColor(Color.GREEN); break;
case 3:
myTextView.setBackgroundColor(Color.BLUE); break;
case 4:
myTextView.setBackgroundColor(Color.BLACK); break;
}
flag++;
}
}
3.运行效果:
4.源代码链接:http://download.csdn.net/detail/feihuiwu123/4483628
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:id="@+id/myText"/>
</RelativeLayout>
2.Activity视图文件:
package com.wh.lcdtest;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;
/**
* @author wh
* @Date 2012-08-07
* @version V0.0
*/
public class MainActivity extends Activity implements OnClickListener{
TextView myTextView;
int flag;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myTextView = (TextView) findViewById(R.id.myText);
myTextView.setText("欢迎使用屏幕测试程序!!请点击屏幕开始测试!!");
myTextView.setTextColor(Color.WHITE);
myTextView.setOnClickListener(this);
flag=1;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void onClick(View view){
String mStr="LCD TEST!!";
System.out.println(mStr);
myTextView.setText("");
flag = flag%5;
switch(flag)
{
case 0:
myTextView.setBackgroundColor(Color.WHITE); break;
case 1:
myTextView.setBackgroundColor(Color.RED); break;
case 2:
myTextView.setBackgroundColor(Color.GREEN); break;
case 3:
myTextView.setBackgroundColor(Color.BLUE); break;
case 4:
myTextView.setBackgroundColor(Color.BLACK); break;
}
flag++;
}
}
3.运行效果:
4.源代码链接:http://download.csdn.net/detail/feihuiwu123/4483628
相关文章推荐
- Android支持多屏幕(7)在不同的屏幕上测试你的程序
- Android开发之程序运行时保持屏幕、CPU、键盘灯的状态
- eclipse中使用真机(已root)测试android程序时,看不到程序包data文件夹下的数据
- 分享方法:android 获得屏幕状态
- 在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- Android 在程序中关闭和打开屏幕
- 十大免费移动程序测试框架(Android/iOS)
- Android如何在测试程序中删除被测应用私有的原始数据
- Android程序对不同手机屏幕分辨率自适应的总结
- 在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- Android 程式开发:(八)处理屏幕方向的变化 —— 8.2在“变化”中保存状态信息
- 2.在Ubuntu上为Android系统内置C可执行程序测试Linux内核驱动程序
- 保持Android设备屏幕常亮和cpu活动状态
- (三) Ubuntu上在eclipse下用真机测试Android程序
- Android GLSurfaceView学习(1):屏幕清理程序,使用随机颜色刷屏
- 模拟机测试Android程序出现INSTALL_FAILED_OLDER_SDK解决办法
- Android的串口通信测试程序
- Socket异步服务器,可以监控客户端的状态,功能有,文字测试,服务端向客户端传输屏幕录像(UDP传输)、监控客户端屏幕(UDP传输),抖动用户窗体、发送文件给用户、扫描客户的C盘目录。
- Android保持屏幕常亮唤醒状态的方法
- Android 获取屏幕高度,标题高度,状态栏高度(实例代码)