TextView changeVideoQualityTxt = (TextView) rootView.findViewById(R.id.enter_wireless_display_txt); String text1 = getString(R.string.enter_applicat.....
分类:
移动开发 时间:
2014-11-26 11:08:22
阅读次数:
223
1、后台设置ImageView的src属性有三种方式:img = (ImageView)this.findViewById(R.id.img_result_analyze);[1]setImageDrawable(drawable):img.setImageDrawable(drawable);[2...
分类:
移动开发 时间:
2014-11-25 14:04:24
阅读次数:
155
LayoutInflater:一般用于查找res/layout下的布局文件,findViewById()一般是用于查找布局下的各种控件一般:我们使用LayoutInflater.from(context).inflate(R.layout.layout, this, true) 来实现布局的动态加载
分类:
移动开发 时间:
2014-11-24 18:44:03
阅读次数:
179
最近没啥事,前段时间看到一个框架是使用的注解来代替findViewById()的然后就研究了,发现还是蛮容易的,下面就是注解的代码:import java.lang.annotation.Documented;import java.lang.annotation.ElementType;impor...
分类:
移动开发 时间:
2014-11-24 09:52:28
阅读次数:
171
Activity页面简单所以XML不再写出、下面给出核心代码:button1=(Button)findViewById(R.id.button1);//为按钮设置监听器button1.setOnClickListener(new OnClickListener()/*在此处使用关键字"new"实例出...
分类:
移动开发 时间:
2014-11-23 15:41:49
阅读次数:
122
定义:1 private RelativeLayout mrlay;调高度:1 mrlay = (RelativeLayout) findViewById(R.id.rlay_1);2 android.view.ViewGroup.LayoutParams pp =mrlay.get...
分类:
移动开发 时间:
2014-11-22 18:41:18
阅读次数:
228
方法一.利用View.OnKeyListener"同步"显示Java代码EditTextmyEdit=(EditText)findViewById(R.id.myEdit);TextViewmyText=(TextView)findViewById(R.id.myText);myEdit.setOn...
分类:
移动开发 时间:
2014-11-21 16:06:50
阅读次数:
276
Java代码:启动动画
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
findViewById(R.id.pw).startAnimation(shake);
anim/shake.xml
<translate xmlns:android="http://schemas.an...
分类:
移动开发 时间:
2014-11-19 16:05:13
阅读次数:
188
上次发了一篇同一TextView内容的不同显示这篇文章,
有关颜色的不同显示,我使用了最简单但是也最复杂的方法,忘记使用SpannableString,现重新发一下,大家参考下。
TextView组件改变部分文字的颜色现在有两种办法,一种是比较笨的方法:
TextView textView = (TextView)findViewById(R.id.textview);
textVie...
分类:
其他好文 时间:
2014-11-19 01:48:55
阅读次数:
168
Fragment和Activity的交互
一个Fragment的实例总是和包含它的Activity直接相关。
fragment可以通过getActivity() 方法来获得Activity的实例,然后就可以调用一些例如findViewById()之类的方法。
如:
View listView = getActivity().findViewById(R.id...
分类:
移动开发 时间:
2014-11-16 12:07:45
阅读次数:
234