开发笔记
2015-11-28 15:17
330 查看
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">本笔记主要是记录平时开发时遇到的细节方面的问题或者常用的小功能的记录。</span>
Ctrl+Shift+Y→大写转小写
2.实现BaseAdapter里面的方法
3.创建构造方法,eg.(Context context,List<String> list)
4.修改getCount()返回值为list.size
5.修改getItem()方法返回值为list.get(position)
6.修改getItemId返回值为position
7重写getView()方法
String.valueOf(double)
push_left_in:
push_left_out:
从右到左滑出
push_right_in:
push_right_out:
1.动态设置布局中ImageView的图片
public void initTitleBar() { ibTab1Left.setBackgroundResource(R.drawable.money_set); ibTab1Right.setBackgroundResource(R.drawable.money_share); tvTitle.setText(R.string.tab1_driving_account_details); // ibTab1Left.getResources().getDrawable(R.drawable.money_set); // ibTab1Right.getResources().getDrawable(R.drawable.money_share); // ibTab1Left.setImageDrawable(getResources().getDrawable(R.drawable.money_set)); // ibTab1Right.setImageDrawable(getResources().getDrawable(R.drawable.money_share)); }
2.利用List动态设置TextView文本信息
此处用了Annotations注解框架@ViewsById({ R.id.text1, R.id.text2 }) List<TextView> list;
@AfterViews public void setTextView() { for (TextView textele : list) { list.get(0).setText("hello"); list.get(1).setText("world"); } }
3.Eclipse/Android Studio 快捷键
Ctrl+Shift+X→小写转大写Ctrl+Shift+Y→大写转小写
4.BaseAdapter使用步骤
1.创建一个MyAdapter继承BaseAdapter2.实现BaseAdapter里面的方法
3.创建构造方法,eg.(Context context,List<String> list)
4.修改getCount()返回值为list.size
5.修改getItem()方法返回值为list.get(position)
6.修改getItemId返回值为position
7重写getView()方法
5.double,int转化为String类型
String.valueOf(int)String.valueOf(double)
6.调用系统相机注意点
1.启动方式Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);2.注册Camera功能(其他应用请求系统相机时会弹出选择对话框),写在AndroidManifest.xml中
<intent-filter> <action android:name="android.media.action.IMAGE_CAPTURE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
7.页面跳转动画效果
从左到右滑出push_left_in:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="200" /> </set>
push_left_out:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="200" /> </set>
从右到左滑出
push_right_in:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="200" /> </set>
push_right_out:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="200" /> </set>
8.在Fragment里面设定点击事件
事件不要在onCreateView里面加,需要的话再onActivityCreate里边加,使用方法和在activity里边是一样的。@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initEvents(); }
9.在Fragment中用BaseAdapter里面getView()方法怎么用
@Override public View getView(int position, View arg1, ViewGroup parent) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_layout, parent, false); <span style="white-space:pre"> </span>//getLayoutInflater().inflate(R.layout.item_layout, null); ImageView touxiang = (ImageView) view.findViewById(R.id.iv_touxiang); TextView neirong = (TextView) view.findViewById(R.id.tv_neirong); touxiang.setImageResource(imageids[position]); neirong.setText(descStrings[position]); return view; }
10.Android TextView文字加下划线
tvForgetPassword.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
相关文章推荐
- 如何成为一名专家级的开发人员
- 肯特·贝克:改变人生的代码整理魔法
- IIS漏洞整理大全
- .NET微信公众号开发之公众号消息处理
- 使用nodejs开发cli项目实例
- nodejs开发微博实例
- Egret引擎开发指南之创建项目
- Android开发自学笔记(二):工程文件剖析
- DWR util.js 学习笔记 整理
- Java开发人员需知的十大戒律
- Web 开发常用工具 大家自己查找下载
- 三种Web开发主流技术的性价评价
- 在B/S开发中经常用到的JavaScript技术第1/3页
- 深入Android开发FAQ的详解
- Android生存指南之:开发中的注意事项
- asp.net 开发的一些常用技巧
- windows开发记事本程序纪实(二)逻辑篇1
- C#开发纽曼USB来电小秘书客户端总结
- node.js调用C++开发的模块实例
- 在EditPlus中配置Perl开发编译环境