码迷,mamicode.com
首页 >  
搜索关键字:findviewbyid    ( 816个结果
关于解决VM heap的问题
今天弄个简单的图片显示程序LinearLayout linearLayout =(LinearLayout)this.findViewById(R.id.LinearLayout1); for(int i=0;i<imagePath.length;i++) { img[i]=new ImageView(this); img[i]....
分类:其他好文   时间:2014-09-07 18:36:05    阅读次数:172
Android LayoutInflater详解
在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById()。不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如Button、Tex...
分类:移动开发   时间:2014-09-04 09:38:37    阅读次数:187
Android应用的Tab键,来回反复点击会报ANR,是空指针导致的,判空就可以解决
getView().findViewById(R.id.iv_tip_update).setVisibility(View.VISIBLE); 以前报空指针 修改后 if(getView()!=null&&getView().findViewById(R.id.iv_tip_update)!=null) { getView().findViewById(R...
分类:移动开发   时间:2014-09-02 15:55:33    阅读次数:209
Button的四种Click响应方法
Button用得挺多的,在这整理了下它的事件处理方法,发现实现方法还不少,我比较喜欢第二种,你呢,最常用哪一种?实现一: Button bt_Demo = (Button)findViewById(R.id.bt_Demo); bt_Demo.setOnClickListener(new...
分类:其他好文   时间:2014-09-01 19:20:03    阅读次数:210
动画 -- 点击按钮 -- 顺时针旋转一圈
1 findViewById(R.id.btnRotateMe).setOnClickListener(new View.OnClickListener() {2 @Override3 public void onClick(View arg0) {4 arg0.s...
分类:其他好文   时间:2014-08-31 21:17:21    阅读次数:169
动画 -- 点击按钮 -- 向右下方移动
1 findViewById(R.id.btnTranslateMe).setOnClickListener(new View.OnClickListener() {2 @Override3 public void onClick(View arg0)...
分类:移动开发   时间:2014-08-31 21:12:41    阅读次数:271
Android解决使用findViewById时需要对返回值进行类型转换问题的辅助类
在我们的开发工作时,findViewById可能是用得最多的函数之一,但它特别讨厌的地方就是我们经常需要对返回的view进行类型转换,输入麻烦、代码抽离。...
分类:移动开发   时间:2014-08-30 23:10:40    阅读次数:308
直接调用系统Camera
关键思路:初始化 组件;创建并启动拍照intent;使用回调函数onActivityResult()处理图像。关键代码:初始化 组件:takePicBtn = (Button) findViewById(R.id.buttonPicture);takePicBtn.setOnClickListene...
分类:其他好文   时间:2014-08-29 19:52:38    阅读次数:162
让NumberPicker中显示文字
最近需要做一个选项框,其中需要选择多个项目,NumberPicker是个不错的选择,如何让它显示文字呢? 其实很简单,如下即可: np = (NumberPicker) findViewById(R.id.numberPicker1); String[] city = {"北京","上海","广州","深圳","成都","天津"}; np.setDisplayedValues(ci...
分类:其他好文   时间:2014-08-27 14:45:37    阅读次数:360
Android 软键盘弹出与关闭监听
private void listenerSoftInput() { final View activityRootView = findViewById(R.id.activityRoot); activityRootView.getViewTreeObserver().addOnGl...
分类:移动开发   时间:2014-08-25 21:04:14    阅读次数:207
816条   上一页 1 ... 72 73 74 75 76 ... 82 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!