转 http://yxwang0615.iteye.com/blog/1711147一个Activity里如果直接用findViewById(),对应的是setConentView()的那个layout里的组件,因此如果你的Activity里如果用到别的layout,你就必须用inflate()先....
分类:
其他好文 时间:
2015-01-28 21:10:10
阅读次数:
227
权限加入设置WebView可用WebView webview = (WebView)findViewById(R.id.vew);webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www.baidu.c...
分类:
Web程序 时间:
2015-01-28 19:33:48
阅读次数:
153
我们一般写findViewById都要加个强制转换,感觉很麻烦,现在你可以在你的BaseActivity中写入如下方法:@SuppressWarnings(“unchecked”)public final E getView (int id) { try { return (E...
分类:
其他好文 时间:
2015-01-28 00:52:38
阅读次数:
208
很多人在网上问LayoutInflater类的用法,以及inflate()方法参数的含义,现解释如下:inflate()的作用就是将一个用xml定义的布局文件查找出来,注意与findViewById()的区别,inflate是加载一个布局文件,而findViewById则是从布局文件中查找一个控件。...
分类:
移动开发 时间:
2015-01-27 19:57:53
阅读次数:
120
#01# 方法一: TextView textView = (TextView) view.findViewById(R.id.text); SpannableString ss = new SpannableString("北京欢...
分类:
移动开发 时间:
2015-01-27 19:57:15
阅读次数:
176
AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE) ;
????????sound = (SeekBar) findViewById(R.id.sb_sound);
????????/**
* 注册...
分类:
其他好文 时间:
2015-01-27 16:36:21
阅读次数:
176
1 LinearLayout layt = (LinearLayout) rootView.findViewById(R.id.llt_2);2 FrameLayout.LayoutParams layoutParams=new FrameLayout...
分类:
移动开发 时间:
2015-01-22 23:06:31
阅读次数:
1149
1.anroid:id的作用?android:id是作为控件的唯一标示符。可以使用与releativelayout中,也可以再Activity中通过findviewbyid来获得指定的控件。2.android:padding 和android:layout_margin的区别。padding是内部,...
分类:
移动开发 时间:
2015-01-22 19:41:31
阅读次数:
138
1.在string.xml文件中:
%1$s牛兑换%2$s%3$s 上网时长]]>
2. 在Java代码中
tv = (TextView) findViewById(R.id.tv);
String exchange = getResources().getString(R.string.exchange_txt_hint);
tv.setText(Html.fromHtml(...
分类:
移动开发 时间:
2015-01-20 20:38:17
阅读次数:
247