在oncreate中,使用getheight等函数不能获得控件大小,得到的为0应使用其他方法 Resourcesres=getResources(); finalImageViewview=(ImageView)findViewById(R.id.IV_about); finalDrawabledrawable=res.getDrawable(R.drawable.ic_about); DisplayMetricsdm=newDisplayMet..
分类:
移动开发 时间:
2014-08-15 14:49:39
阅读次数:
230
框架地址:https://github.com/yangfuhai/afinal
对应的源码:
net.tsz.afinal.annotation.view.*
FinalActivity
FinalActivity是一个基础类,结合注解实现了,依赖注入(view的资源id,常用的监听器), 利用set方式注入
完全注解方式就可以进行UI绑定和事件绑定,无需findViewById和se...
分类:
移动开发 时间:
2014-08-15 02:38:36
阅读次数:
280
在实际工作中,事先写好的布局文件往往不能满足我们的需求,有时会依据情况在代码中自己定义控件,这就须要用到LayoutInflater。LayoutInflater在Android中是“扩展”的意思,作用相似于findViewById(),不同的是LayoutInflater是用来获得布局文件对象的,...
分类:
其他好文 时间:
2014-08-14 23:30:36
阅读次数:
256
把 XXX.txt文件 写入/读取 在data/data/包 目录下面。 1 /** 读写内部存储的文件数据 */ 2 findViewById(R.id.btnWrite).setOnClickListener( 3 new View.OnCli...
分类:
其他好文 时间:
2014-08-13 18:28:36
阅读次数:
227
1、View的基本概念 View就是所有控件类的父类。(文本、按钮、多选、布局、··· ···)2、在Activity当中获取代表View的对象 使用findViewById(R.id.ppp) ;ppp表示控件的ID 例如TextView textView= (TextView)findVi...
分类:
移动开发 时间:
2014-08-13 00:33:44
阅读次数:
259
网络图片查看器
输入网络图片路径,点击查看把web应用的图片显示在手机上
MainActivity
{
EditText pathText=(EditText) this.findViewById(R.id.imagepath);
Button button=(Button) this.findViewById(R.id.button);
ImageView imageView ...
分类:
移动开发 时间:
2014-08-12 13:43:44
阅读次数:
188
findViewById中NullPointerException的错误...
分类:
其他好文 时间:
2014-08-06 22:59:13
阅读次数:
451
LayoutInflater作用是将layout的xml布局文件实例化为View类对象。对于一个没有被载入或者想要动态载入的界面,都需要使用LayoutInflater.inflate()来找 res/layout下的 xml 布局文件,并且实例化为View类对象;获取LayoutInflater的...
分类:
其他好文 时间:
2014-08-05 13:48:19
阅读次数:
192
WebView是View的一个子类,可以让你在activity中显示网页。 可以在布局文件中写入WebView:比如下面这个写了一个填满整个屏幕的WebView: 加载一个网页,使用loadUrl():WebView myWebView = (WebView) findViewById(R.i...
分类:
Web程序 时间:
2014-08-05 13:41:49
阅读次数:
317
效果图:
这样来写:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
ListView list = (ListView)findViewById(R.i...
分类:
移动开发 时间:
2014-08-01 23:15:32
阅读次数:
346