![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
android之界面
amberoot_源狼乐
It isn't the burdens today that drive me mad,it is the regrets over yesterday and the fear of tomorrow.
展开
-
android之bitmap和byte[]互转
//drawable转bitmap Bitmap imageBitmap = BitmapFactory.decodeResource(myContext.getResources(), R.drawable.example); //bitmap转bytes ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream(); imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, byt.原创 2020-05-22 17:13:59 · 1047 阅读 · 0 评论 -
Android之自定义对话框Dialog
自定义Dialog,布局自定义,所以布局文件(layout_alert.xml)就不贴了,直接贴代码: public void showAlertDilog(Context context,String mes) { if (dialog != null) { if (!dialog.isShowing()) { ...原创 2017-05-11 13:48:16 · 295 阅读 · 0 评论 -
Android之简单Tab的制作
第一步:先设计好布局,我弄了四个小RelativeLayout,每个就是一个Tab,里面包含一个imageview和一个button,其button可以用textview代替。 代码: ...原创 2017-05-05 17:04:33 · 420 阅读 · 0 评论 -
android之简易画板(涂鸦)实例(透明背景)
一、创建变量 //DoodleView private Paint mPaint = new Paint(); private List<Path> mPathList = new ArrayList<>(); // 保存涂鸦轨迹的集合 private float mLastX, mLastY; private Path mCurrentPath; // 当前的...原创 2019-09-18 15:57:49 · 1039 阅读 · 0 评论 -
Android之获取Fragment和activity的宽和高
获取Fragment的宽高 @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //获取屏幕宽高 Point size = new Poin...原创 2019-07-04 16:50:52 · 2628 阅读 · 0 评论 -
Android之Material Design之可刷新的滑动列表(RecyclerView)
Material Design控件的简单介绍: Toolbar — 加强版ActionBar,用setSupportActionBar()方法将Toolbar实例传入 (app:showAsAction-用来指定按钮的显示位置)。 DrawerLayout — 用于滑动菜单。 FloatingActionButton — 悬浮按钮。 Snackbar — 可交互式提示。 Coordina...原创 2018-06-01 18:10:59 · 890 阅读 · 1 评论 -
Android Toolbar使用
1. 应用//获取Toolbar布局 Toolbar toolbar = findViewById(R.id.toolbar); //方法将Toolbar实例传入 setSupportActionBar(toolbar); //添加系统返回按钮在toolbar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) {...原创 2018-05-07 14:58:19 · 259 阅读 · 0 评论 -
android之DatePickerDialog与TimePickerDialog的简单例子
private void showSetDateDialog() { //获取当前时间 Calendar cal= Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar...原创 2018-05-07 17:42:29 · 426 阅读 · 0 评论 -
Android之RecyclerView嵌入CheckBox显示问题解决(列表单选)
这里RecyclerView嵌入CheckBox时滑动列表,列表item中的会产生错位现象,解决这个问题需在Adapter中onBindViewHolder方法中处理。下面的例子是列表单选,所以只设定了一个整型变量来保存当前选中的CheckBox,若是多选,可用List保存列表所有CheckBox的选中状态。 1. 设置CheckBox的标签为position+1,即CheckBox的标签从...原创 2018-06-02 11:02:08 · 1430 阅读 · 0 评论 -
Android之ViewPager与Fragment
功能是利用viewpager,通过按钮 btn1 和按钮 btn2 切换fragment1页面和fragment2页面。 下面是activity_main.xml布局文件:(底部两个按钮,上面一个ViewPager) <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLa...原创 2019-12-06 15:12:08 · 164 阅读 · 0 评论