![](https://img-blog.csdnimg.cn/20201118223213336.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Android
安卓学习部分
wealth_gold
这个作者很懒,什么都没留下…
展开
-
二、Android 自定义组合控件
二、自定义组合控件 开发步骤 继承自linearLayout或者RelativeLayout 定义相关属性,获取属性(自定义属性) 加载组合View,初始化值 处理相关事件(如按钮的点击事件) 定义功能接口,对外暴露方法(把值传到外面) 例子: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andro原创 2020-12-14 22:44:37 · 218 阅读 · 0 评论 -
Android自定义控件基础知识
一、基础知识 px:像素点 dp:与像素密度相关 sp:类似dp(一般用来修饰文字) dp会在不同的设备上显示的大小差不多; 转换公式 /** * 根据手机的分辨率从 dp 的单位 转成为 px(像素) */ public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().d原创 2020-12-10 23:32:44 · 144 阅读 · 0 评论 -
Dialog常用写法
普通 AlertDialog AlertDialog dialog = new AlertDialog.Builder(context).create(); dialog.setTitle("提示"); dialog.setMessage("您确定退出程序吗?"); dialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() { @Override public v原创 2020-11-21 16:23:45 · 556 阅读 · 0 评论 -
fragment切换 常用写法
layout <FrameLayout android:id="@+id/main_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/view_line"/> Activity onCreate方法 @Override protected原创 2020-11-20 11:09:11 · 216 阅读 · 0 评论 -
ListView常用写法
ListView EquipStaDialogAdapter nextOrderAdapter = new EquipStaDialogAdapter(getActivity(), List<OrderTable>); listview.setAdapter(nextOrderAdapter); // 常用方法:刷新数据 nextOrderAdapter.notifyDataSetChanged(); Adapter public class EquipStaDialogAdapter e原创 2020-11-20 10:30:27 · 127 阅读 · 0 评论