03 2016 档案

摘要:public class DensityUtils { /** * dp转px */ public static int dp2px(Context ctx, float dp) { float density = ctx.getResou... 阅读全文
posted @ 2016-03-29 14:40 云中鹤5786 阅读(112) 评论(0) 推荐(0)
摘要://只含有list的view View menuview = View.inflate(mActivity, R.layout.news_menu_detail, null); mlvNewsDetail = (ListView) menuview.fi... 阅读全文
posted @ 2016-03-27 21:29 云中鹤5786 阅读(126) 评论(0) 推荐(0)
摘要://只含有list的view View menuview = View.inflate(mActivity, R.layout.news_menu_detail, null); mlvNewsDetail = (ListView) menuview.fi... 阅读全文
posted @ 2016-03-27 20:44 云中鹤5786 阅读(323) 评论(0) 推荐(0)
摘要:使ViewPager不能左右滑动 @Override public boolean onTouchEvent(MotionEvent arg0) { // TODO Auto-generated method stub return fals... 阅读全文
posted @ 2016-03-26 14:52 云中鹤5786 阅读(96) 评论(0) 推荐(0)
摘要:1、在xml文件中应用控件 2、在java中 绑定菜单titleindicator = (TabPageIndicator)view.findViewById(R.id.indicator);vPager.setAdapter(new TabDetailAdapte... 阅读全文
posted @ 2016-03-25 21:15 云中鹤5786 阅读(170) 评论(0) 推荐(0)
摘要:一、抽取 BaseFragment ** * @类名 BaseFragment * @创建者 ppa * @创建时间 2016-3-21 * @描述 TODO */ public abstract class BaseFragment extends Fragment {... 阅读全文
posted @ 2016-03-24 21:52 云中鹤5786 阅读(312) 评论(0) 推荐(0)
摘要:1、listview 点击事件 lvLeftMemu.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView arg0, View arg1, in... 阅读全文
posted @ 2016-03-24 20:05 云中鹤5786 阅读(495) 评论(0) 推荐(0)
摘要:1、 2、(1)在LeftMenuFragment中添加 public void SetData(String str){ System.out.println("侧栏接收到的数据是"+str); } (2)在Main2Activity中根据标查找Fragment //... 阅读全文
posted @ 2016-03-24 16:29 云中鹤5786 阅读(201) 评论(0) 推荐(0)
摘要:1、抽取BasePager /** * @类名 BasePager * @创建者 ppa * @创建时间 2016-3-22 * @描述 TODO */ public class BasePager { public Activity mActivity; public... 阅读全文
posted @ 2016-03-22 16:37 云中鹤5786 阅读(159) 评论(0) 推荐(0)
摘要:主要参考:http://blog.csdn.net/zhaokaiqiang1992/article/details/40371031 http://www.open-open.com/lib/view/open1405218387226.html 1、导入 library 2、继承 Sl... 阅读全文
posted @ 2016-03-21 20:55 云中鹤5786 阅读(810) 评论(0) 推荐(0)
摘要:一、定义 /** * @类名 BaseFragment * @创建者 ppa * @创建时间 2016-3-21 * @描述 TODO */ public abstract class BaseFragment extends Fragment { public Ac... 阅读全文
posted @ 2016-03-21 20:41 云中鹤5786 阅读(154) 评论(0) 推荐(0)
摘要:1、常规代码 SharedPreferences sp = getSharedPreferences("config",MODE_PRIVATE); sp.edit().putBoolean("is_guide_showed",true).commit(); SharedPreference... 阅读全文
posted @ 2016-03-21 14:41 云中鹤5786 阅读(135) 评论(0) 推荐(0)
摘要:class GuideAdapter extends PagerAdapter{ @Override public int getCount() { return mImages.length; } @Override public boolean... 阅读全文
posted @ 2016-03-21 14:06 云中鹤5786 阅读(137) 评论(0) 推荐(0)
摘要:一、主流屏幕 1280*720 二、常见适配方法 1、图片适配 2、布局适配 layout-800x480 values-1280x720 dimen 定义不同屏幕尺寸 3、尺寸适配 dp=px ... 阅读全文
posted @ 2016-03-19 21:45 云中鹤5786 阅读(115) 评论(0) 推荐(0)
摘要:一、步骤 1、定义并调用本地方法 private native int add(int i,int j); 2、在根目录下创建jni文件夹 3、jni文件夹里创建c文件 #include jint Java_com_exampl... 阅读全文
posted @ 2016-03-19 14:34 云中鹤5786 阅读(348) 评论(0) 推荐(0)
摘要:一、添加指示点 1、用xml文件设置selecet方式的state_enable=true/false属性 2、用2个xml文件设置shape形式 二、实现无限循环滑动 1、设置中间值 int dex=Integer.MAX_VALUE/2-... 阅读全文
posted @ 2016-03-18 11:07 云中鹤5786 阅读(246) 评论(0) 推荐(0)
摘要:一、实现的思路 1、获取网络地址path 2、建立url对象 3、建立url连接conn 4、设置conn的连接方法 5、获取conn的输入流 7、new一个byte[] 数组 8、建立一个本地的文件File,并获取file的outputstream 9、用outputstream将... 阅读全文
posted @ 2016-03-17 15:50 云中鹤5786 阅读(222) 评论(0) 推荐(0)
摘要:一、条件: 1、访问网络权限 2、访问网络需另开线程 3、获取网络资源后需用handmsg辅助线程刷新页面 二、代码: 1、确定网址 String path="http://192.168.2.101:8080/ppa_web/i... 阅读全文
posted @ 2016-03-17 11:09 云中鹤5786 阅读(269) 评论(0) 推荐(0)
摘要:1、定义style.xml文件 2、在控件中引用 阅读全文
posted @ 2016-03-17 08:44 云中鹤5786 阅读(141) 评论(0) 推荐(0)
摘要:一、使用xml文件定义动画 (在animator文件夹下) 1、定义 2、在代码中使用 //使用xml设置动画 //先获取到动画对象 ObjectAnimator oa=(ObjectAnimator) AnimatorInflater.loa... 阅读全文
posted @ 2016-03-16 16:15 云中鹤5786 阅读(130) 评论(0) 推荐(0)
摘要:1、设置动画布局文件(在drawable中添加xml文件) 2、播放动画 //设置开机动画 ImageView iv=(ImageView) findViewById(R.id.i... 阅读全文
posted @ 2016-03-16 15:25 云中鹤5786 阅读(114) 评论(0) 推荐(0)
摘要:一、创建Fragment //继承fragment类 public class Fragment01 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, Vi... 阅读全文
posted @ 2016-03-16 10:03 云中鹤5786 阅读(106) 评论(0) 推荐(0)
摘要:1、创建openhelper类 public class MyOpenHelper extends SQLiteOpenHelper { public MyOpenHelper(Context context) { super(context, "student.db", null, 3)... 阅读全文
posted @ 2016-03-09 21:58 云中鹤5786 阅读(321) 评论(0) 推荐(0)
摘要:一、android 内部存储路径 1、应用数据的路径 data/data/com.ppa.threadtest/login.txt" 2、getFilesDir() 获取的路径 data/data/com.ppa.threadtest/files/ getCacheDir... 阅读全文
posted @ 2016-03-08 16:31 云中鹤5786 阅读(147) 评论(0) 推荐(0)
摘要:1、FrameLayout android:layout_gravity="right|bottom" 2、相对某个控件同时左对齐,右对齐,则此控件随着相对控件的大小变化而变化。 3、LinearLayout 中布局自由分配 layout_weight="1"; la... 阅读全文
posted @ 2016-03-08 14:23 云中鹤5786 阅读(74) 评论(0) 推荐(0)
摘要:1、 //android动画 AlphaAnimation animation=new AlphaAnimation(0.0f, 1.0f); animation.setDuration(3000); btnSubmit.setAnimation(animation); 阅读全文
posted @ 2016-03-08 10:45 云中鹤5786 阅读(125) 评论(0) 推荐(0)
摘要:1、代码 public class ToastUtils { private static Toast mToast; public static void showToast(Context context,CharSequence text,int dura... 阅读全文
posted @ 2016-03-04 14:54 云中鹤5786 阅读(369) 评论(0) 推荐(0)