1、一个activity就要有一个布局,所以新建一个Activity的时候总会新建一个相应的layout2、Activity的生命周期3、Activity的之间的参数传递,用Intent i;i4、打开一个新的Activity,startnewbtn=(Button)findViewById(R.i...
分类:
移动开发 时间:
2015-08-27 02:08:51
阅读次数:
143
android使用微软雅黑字体,需要下载字体 ttf文件下载地址:http://download.csdn.net/detail/xiaoliu123586/9049219放在assert,然后引用即可,如下图:1 Button button= (Button) this.findViewById(...
分类:
移动开发 时间:
2015-08-26 13:52:28
阅读次数:
534
获取手机设备型号等信息:
如图华为P6手机获取是手机设备信息值:
代码如下:
tvStr = (TextView) findViewById(R.id.tv_titlebar);
String phoneInfo = "Product: " + android.os.Build.PRODUCT + "\n";
phoneInfo += "CP...
分类:
移动开发 时间:
2015-08-26 11:59:52
阅读次数:
201
public?void?onCreate(Bundle savedInstanceState)?{ ????super.onCreate(savedInstanceState); ??? setContentView(R.layout.main); ??? TextView textView?=?(TextView)?findViewById(R.id.tex...
分类:
移动开发 时间:
2015-08-21 21:46:31
阅读次数:
212
1、LayoutInflater 的介绍和用法http://www.cnblogs.com/androidez/archive/2013/07/01/3164729.html关键区别就在于 inflate是寻找xml文档对象的,而findViewById是在已知的文档对象上寻找Widget的,比如按...
分类:
移动开发 时间:
2015-08-21 11:05:27
阅读次数:
175
JakeWharton 的butterknife帮我们有效的解决了findViewById及各种view的监听事件泛滥的问题,极大的简化了代码,如果使用了android Studio开发的配上avast的android-butterknife-zelezny插件,则可以一键注解所有view,极大提高编码效率。一直在用android-butterknife-zelezny,也在自己的业余时间尝试过去修...
分类:
其他好文 时间:
2015-08-21 09:34:40
阅读次数:
160
※效果
※用法
seekBarPressures = (SeekBarPressure) findViewById(R.id.seekBar_tg2);
seekBarPressures.setOnSeekBarChangeListener(new SeekBarPressure.OnSeekBarChangeListener() {
@O...
分类:
移动开发 时间:
2015-08-20 10:44:32
阅读次数:
430
※效果
※用法
private void init() {
sb_user = (SeekBarPressure) findViewById(R.id.sb_user);
sb_user.setProgressLowInt(2);
sb_user.setProgressHighInt(4);
sb_user.set...
分类:
移动开发 时间:
2015-08-20 10:42:15
阅读次数:
1014
一、R文件是什么? 如上图所示,我们可以通过findViewById方法通过传入R.id.show找到我们的TextView元素,findViewById方法也很好理解,从View中通过Id找到,那么R是什么呢? 资源文件的使用分为在代码中使用和在其他资源文件中引用该资源文件。在我们编译一个Andr...
分类:
移动开发 时间:
2015-08-20 09:09:19
阅读次数:
164
1.在参数中直接new一个OnClickListenerButton button1=(Button) findViewById(R.id.button1);//事件源
button1.setOnClickListener(new OnClickListener(){
@Override
//findViewById得到的是一个View对象...
分类:
移动开发 时间:
2015-08-19 20:33:06
阅读次数:
151