ITeye博客

android

共 10 篇文章

ArrayAdapter requires the resource ID to be a TextView问题

在使用ArrayAdapter时使用自己写的R.layout.list_item布局容易出现:ArrayAdapter requires the resource ID to be a TextView 报错 R.layout.list_item.xml: xmlns:android=http://schemas.android.com/apk/res/android 就是这句了.... 添加到自己的TextView中就ok. 因为根节点必须是TextView 修改后的list_item.xml [java] view plaincopyprint?

2013-08-09 07:00 · android · Android

疯狂android讲义学习总结---ImageView

imageView 做图片浏览器 ================================================================================== =============================================================================== java代码: package com.example.imageviewtest; import android.os.Bundle; import android.app.Activity; import android.graphi…

2013-05-18 13:32 · android

疯狂android讲义学习总结---toggle与switch

ToggleButton 与Switch二者都是Button的子类,与RadioButton和CheckBox不同的是,ToggleButton 与Switch二者通常用作切换程序中的某种状态 ToggleButton 与Switch二者常用的xml属性是 android:checked;android:textOn;android:textOff; 而Switch常用的属性还有,android:thumb; 由于Switch是android4.0以后才有的版本,所以用该按钮的时候 一定要将项目的anroid版本调高一些,或者将AVD的API调高一些。才不会出现问题,本文利用这两个按钮来控制…

2013-05-16 18:49 · android

疯狂android讲义学习总结---RadioButton——CheckBox

RadioButton(单选按钮)与CheckBox(复选框)都是Button的子类,Button的所有属性二者都可用,唯一不同的是二者多一个android:checked的属性,下面的程序中添加了一个RadioGroup按钮,包括两个RadioButton,RadioGroup有自己的唯一的ID标识,RadioButton也有自己的唯一的ID标识。彼此不同。本文中对该RadioGroup设置了一个事件监听 rg.setOnCheckedChangeListener(new CheckedChangeListener() { @Override public void OnCheckedCh…

2013-05-16 12:10 · android

疯狂android讲义学习总结---TextView

这里只想说一句,在EditText中 如果想让输入框中的有默认的内容,用hint

2013-05-16 10:50 · android

疯狂android讲义学习总结---各种按钮的制作

第一种:给按钮的文字加重影操作 重影操作主要涉及android的四个xml属性,分别是 shadowColor,shadowRadius,shadowDx,shadowDy。 第二种:用图片作为按钮 第三种:在按的时候可以设置鼠标的动作 用drawable类,绘制xml文件 这里的button_selector是一个存放在,res/drawable/mdpi文件夹下的xml文件,内容如下

2013-05-16 10:46 · android

android之sqlite数据库初级

package com.example.testsqlite; import android.os.Bundle; import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import android.view.Menu; import andro…

2013-03-11 23:52 · android

libgdx--中文显示与汉字绘制

要用libgdx框架下显示中文 那么不得不用到hiero工具首先下载hiero.jar工具,运行hiero.jar 设置自己喜欢的字体 并保存入下图 自动生成俩个文件 .png,和 .fnt并把这俩个文件存入assets文件夹中。 private BitmapFont bitmapfont; private SpriteBatch batch; @Override public void create() { // TODO Auto-generated method stub batch=new SpriteBatch(); bitmapfont = new BitmapFont(Gdx.…

2013-03-05 11:02 · android

libgdx的使用--绘制图片

上一节我们用到了SpriteBatch类 但是我们并没有使用它 现在用它的draw()方法来绘制图片的位置. 要绘制图片 首先要有图片 ,我们找到图片存储在assets文件夹中,assets文件夹是开发android工程中专门存储图片的文件夹 首先要声明一个Texture 私有变量texture;在HelloGame类中的create()方法里实例化一个Texture; texture=new Texture(Gdx.files.internal("meinv.jpg")); 这里要注意的有俩点:1图片的像素必须是2的次方,在导入前必须要对该图片进行处理成2的次方的 像素.2(Gdx.fil…

2013-03-02 14:19 · android

libgdx的使用--环境搭建测试

首先在eclise中创建android工程 new-->project-->android project.最低兼容版本选择1.5最高一般选择3.2 theme选项 选择holo light; 默认的类名为MainActivity.java 将其继承AndroidApplication类,此类作为主线程 新建一个类 名为HelloGame类实现ApplicationListener接口,声明私有变量SpriteBatch,并在create()函数中将私有变量SpriteBatch实例化,并且在render()函数中设置SpriteBatch的开始与结束. 运行android虚拟机 将看到只是…

2013-03-02 11:00 · android