final static int[] COLOR_LIST={Color.WHITE,Color.WHITE,Color.GRAY,Color.YELLOW,Color.RED}; spinner=(Spinner)findViewById(R.id.spinner1); ArrayA...
分类:
移动开发 时间:
2014-12-25 22:00:44
阅读次数:
313
代码如下: String?string?=?"市场价:¥158.00"; TextView?textView?=?(TextView)?findViewById(R.id.textView); SpannableString?sp?=?new?SpannableString(string); sp.setSpan(new?Strikethrough...
分类:
其他好文 时间:
2014-12-25 11:34:42
阅读次数:
699
组件位置:composite>WebView.xml1 .java1 private WebView webview_pipeweb;2 3 webview_pipeweb = (WebView) findViewById(R.id.webview_pipeweb);4 //setWebVi...
分类:
移动开发 时间:
2014-12-24 17:35:29
阅读次数:
138
一、[Android实例]实现TextView里的文字有不同颜色转eoe:http://www.eoeandroid.com/thread-4496-1-1.htmlimport android.text.Html;TextView t3 = (TextView) findViewById(R.id...
分类:
移动开发 时间:
2014-12-24 13:09:50
阅读次数:
155
有时候一个文本框为了强调内容需要显示不同颜色,用以下代码可以轻松实现
//为文本框设置多种颜色
textView=(TextView)findViewById(R.id.text_show);
SpannableStringBuilder style = new SpannableStringBuilder("备注:签收人(张三)");
style...
分类:
移动开发 时间:
2014-12-24 00:02:08
阅读次数:
303
editText=(EditText)findViewById(R.id.myEditText); // editText.setHeight(10); //不生效 editText.getLayoutParams().height = 100; onCreate()里...
分类:
其他好文 时间:
2014-12-22 12:55:19
阅读次数:
161
作用:用来实例化一个XML文件到指定View中。与findViewById类似,不同的是LayoutInflater找的res文件下的没有被载入或需动态被载入,对于已经载入的Activity可以使用findViewById来获得其中的界面元素。获得LayoutInflater的几种方式:1. Lay...
分类:
其他好文 时间:
2014-12-19 12:54:20
阅读次数:
152
我跟着教程 ,通过向导创建了一个新的activity ,当我运行时在 onCreate方法里面调用findViewById()方法时报错 NullPointerException 。
Layout XML (fragment_main.xml):
http://schemas.android.com/apk/res/android"
xmlns:tools="http://schem...
分类:
其他好文 时间:
2014-12-19 12:19:43
阅读次数:
214
在实际工作中,事先写好的布局文件往往不能满足我们的需求,有时会根据情况在代码中自定义控件,这就需要用到LayoutInflater。LayoutInflater在Android中是“扩展”的意思,作用类似于findViewById(),不同的是LayoutInflater是用来获得布局文件对象的,而...
分类:
其他好文 时间:
2014-12-17 23:54:29
阅读次数:
349
Android屏幕截图功能实现这里介绍两种方式:
第一种 截取整个屏幕实现方式三种
ImageView imgV = (ImageView) findViewById(R.id.ImageView01);
ImageView
imgV2 = (ImageView) findViewById(R.id.ImageView02);
ImageView
imgV3 ...
分类:
移动开发 时间:
2014-12-17 21:04:03
阅读次数:
185