
Android
文章平均质量分 65
Android相关
Prosper Lee
谁又能来拯救我这灰暗的人生呢……
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Android(五十八):WebView - 解决 <input type=“file“ />标签点击无效问题
展示源码Web H5端<input id="file" type="file" onchange="handleUploadFile(this)"></input><script>// 文件上传const handleUploadFile = ({files}) => { let formData = new FormData(); Object.values(files).forEach(file => { fo原创 2021-12-28 14:49:00 · 2440 阅读 · 5 评论 -
Android(五十七):WebView - 获取网页logo和标题、监听页面滚动、刷新页面、两端交互
展示源码web端<!DOCTYPE html><html lang="zh-cn"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,user-scalable=no,ini原创 2021-12-24 16:57:02 · 2903 阅读 · 0 评论 -
Android(五十六):单文件、多文件 上传
展示源码服务器端const http = require('http');const url = require('url');const querystring = require("querystring");const formidable = require('formidable'); // npm install formidableconst fs = require('fs');const path = require('path');var util = require原创 2021-12-23 11:51:31 · 2419 阅读 · 1 评论 -
Android(五十五):解析JSON数据
展示源码const string jsonString = "{\"name\":\"张三\",\"age\":24,\"obj\":{\"avatar\":null,\"men\":true,\"list\":[\"000\",{\"label\":\"哈哈哈哈\"},\"222\", [\"333\",{\"label\":\"Hello\"}]]}}";GetJsonData(jsonString);Log.Debug(TAG, "=============================原创 2021-12-19 20:07:40 · 980 阅读 · 0 评论 -
Android(五十四):SAX、DOM、XmlReader 解析XML数据
展示源码var xmlText = FindViewById<TextView>(Resource.Id.xml_text);SAX// SAXvar btn01 = FindViewById<Button>(Resource.Id.btn_01);if (btn01 != null) btn01.Click += delegate { SaxHelper.XmlData = ""; if (xmlText == nu原创 2021-12-19 18:13:07 · 1331 阅读 · 0 评论 -
Android(五十三):HttpURLConnection - GET、POST数据请求
展示目录布局PrimaryBlankApp/Resources/layout/activity_main.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="h原创 2021-12-16 16:06:14 · 959 阅读 · 0 评论 -
Android(五十二):GetSharedPreferences 数据存储与访问
展示源码private ISharedPreferences _sharedPreferences;_sharedPreferences = GetSharedPreferences("loginInfo", FileCreationMode.Private);var username = FindViewById<EditText>(Resource.Id.username);var password = FindViewById<EditText>(Resourc原创 2021-12-12 12:46:55 · 1243 阅读 · 0 评论 -
Android(五十一):文件读写
文件读写var fileName = FindViewById<EditText>(Resource.Id.file_name); // 文件名 var fileContent = FindViewById<EditText>(Resource.Id.file_content); // 文件内容var writeFileBtn = FindViewById<Button>(Resource.Id.write_file_btn); /原创 2021-12-10 10:27:35 · 1626 阅读 · 0 评论 -
Android(五十):Fragment、ViewPager - 实现导航和页面的切换
展示目录源码创建主布局Resources/layout/main.xml<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"原创 2021-12-09 13:15:33 · 1538 阅读 · 0 评论 -
Android(四十九):Fragment-实现底部导航和导航消息通知
展示源码布局<!--Resources/layout/main.xml--><?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent">原创 2021-12-08 20:25:12 · 837 阅读 · 0 评论 -
Android(四十八):读取手机短信
展示源码向AndroidManifest.xml添加权限<!--读取短信信息--><uses-permission android:name="android.permission.READ_SMS" />判断权限并逐条获取短信信息using Android;using Android.App;using Android.Content.PM;using Android.OS;using Android.Util;using Android.Widget;原创 2021-12-05 18:14:01 · 2104 阅读 · 0 评论 -
Android(四十七):BroadcastReceiver 广播
展示源码发送广播// 实例化一个广播(注册广播动作) 必须var receiver = new Receiver();RegisterReceiver(receiver, new IntentFilter("PLee"));// RegisterReceiver(receiver, new IntentFilter("Hi"));var btn01 = FindViewById<Button>(Resource.Id.btn_01);if (btn01 != null)原创 2021-12-02 11:29:22 · 711 阅读 · 0 评论 -
Android(四十六):真机无线调试Android应用
手机开启无线调试(需要连接数据线,打开USB调试)进入Android\Sdk\platform-tools\打开终端执行以下命令.\adb.exe pair 192.168.3.24:38109 提示输入配对码.\adb.exe connect 192.168.3.24:41347 手机提示无线连接成功,可拔取数据线.\adb.exe devices -l 查看已连接设备连接成功后即可无线调试了...原创 2021-11-24 21:25:10 · 1105 阅读 · 0 评论 -
Android(四十五):Service - StartService、StopService实现媒体播放
实现媒体播放(与直接播放媒体资源的对比)目录结构源码布局Resources/layout/main.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_p原创 2021-11-23 14:11:35 · 1454 阅读 · 0 评论 -
Android(四十四):Service
ServiceStarted Service(Service类 和 Activity类 )Activity通过调用StartService这个方法启动服务Activity销毁不会影响Service的运行Bound Service(Service类 和 Activity类 )Activity通过调用BindService这个方法绑定启动服务(捆绑关系)Activity销毁会停止Service的绑定并销毁服务展示示例// Serviceusing Android.App;原创 2021-11-22 16:11:20 · 564 阅读 · 0 评论 -
Android(四十三):Activity数据传递
单数据传递// Activity单数据传递var submitBtn = FindViewById<Button>(Resource.Id.submit_btn);var name = FindViewById<EditText>(Resource.Id.name);if (submitBtn != null) submitBtn.Click += (sender, args) => { var intent = new Intent(t原创 2021-11-18 14:46:09 · 644 阅读 · 0 评论 -
Android(四十二):Drawable 转 Bitmap
源码/// <summary>/// Drawable 转 Bitmap/// </summary>/// <param name="drawable"></param>/// <returns></returns>private static Bitmap OnGetBitmap(Drawable drawable){ var bitmap = Bitmap.CreateBitmap(drawable.Intri原创 2021-11-18 14:35:02 · 1800 阅读 · 0 评论 -
Android(四十一):Activity生命周期
生命周期图片转自:https://www.runoob.com/w3cnote/android-tutorial-activity.htmlusing Android.App;using Android.OS;using Android.Util;namespace android_by_csharp.Scripts{ [Activity(Label = "CustomActivity")] public class CustomActivity : Activity原创 2021-11-08 15:17:48 · 1064 阅读 · 0 评论 -
Android(四十):Activity - Uri、Intent应用示例
展示源码MainActivity.csvar runExActivityBtn = FindViewById<Button>(Resource.Id.runExActivityBtn);if (runExActivityBtn != null) runExActivityBtn.Click += (sender, args) => OnRunExActivity();private void OnRunExActivity(){ var intent = new Inte原创 2021-11-08 14:25:35 · 1789 阅读 · 0 评论 -
Android(三十九):Gestures 手势
展示源码<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:原创 2021-11-02 16:29:46 · 235 阅读 · 0 评论 -
Android(三十八):Configuration
展示源码<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp"> <Scroll原创 2021-11-02 13:50:55 · 817 阅读 · 0 评论 -
Android(三十七):图片双指缩放
展示源码using Android.App;using Android.OS;using Android.Util;using Android.Views;using Android.Widget;namespace android_by_csharp{ [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] public class MainActivi原创 2021-11-02 10:08:26 · 991 阅读 · 0 评论 -
Android(三十六):DrawerLayout 侧滑菜单
展示源码<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height=原创 2021-11-01 10:15:37 · 192 阅读 · 0 评论 -
Android(三十五):ViewPager 页面切换
展示源码布局<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.view.ViewP原创 2021-11-01 08:51:52 · 608 阅读 · 0 评论 -
Android(三十四):PopupMenu 菜单
展示源码菜单 Resources/menu/menu.xml<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:title="菜单 1"/> <item android:title="菜单 2"> <menu>原创 2021-10-31 14:24:29 · 288 阅读 · 0 评论 -
Android(三十三):PopupWindow 悬浮窗
展示处理素材源码主布局<ImageButton android:id="@+id/avatar_btn" android:layout_width="60dp" android:layout_height="60dp" android:background="@drawable/avatar"/>悬浮窗布局 Resources/layout/popover_view.xml<?xml version="1.原创 2021-10-29 16:30:10 · 1727 阅读 · 0 评论 -
Android(三十二):AlertDialog 对话弹窗
展示源码普通弹窗var btn01 = FindViewById<Button>(Resource.Id.btn_01);var btn02 = FindViewById<Button>(Resource.Id.btn_02);var btn03 = FindViewById<Button>(Resource.Id.btn_03);var btn04 = FindViewById<Button>(Resource.Id.btn_04);if原创 2021-10-29 13:35:52 · 253 阅读 · 0 评论 -
Android(三十一):Notification 状态栏通知
展示源码<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" androi原创 2021-10-29 10:02:34 · 205 阅读 · 0 评论 -
Android(三十):Toast
Toast - 01Toast.MakeText(this, "默认吐司", ToastLength.Short)?.Show();Toast - 02var toast01 = Toast.MakeText(this, "自定义位置吐司", ToastLength.Short);toast01?.SetGravity(GravityFlags.Top, 0, 0); // 设置显示位置toast01?.Show();Toast - 03toast_view.xml<?xml ve原创 2021-10-26 09:59:02 · 117 阅读 · 0 评论 -
Android(二十九):ViewFlipper 轮播图
展示源码<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:原创 2021-10-25 16:37:44 · 293 阅读 · 0 评论 -
Android(二十八):ExpandableListView 可折叠列表
展示源码主布局 Resources/layout/main.xml<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:ba原创 2021-10-25 14:38:04 · 601 阅读 · 0 评论 -
Android(二十七):AutoCompleteTextView、MultiAutoCompleteTextView - 单选、多选 可查询下拉选择框
展示(注意效果)源码<AutoCompleteTextView android:id="@+id/auto_complete_text_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:completionThreshold="0" android:dropDownHorizontalOffset="5dp" /><M原创 2021-10-22 10:20:45 · 381 阅读 · 0 评论 -
Android(二十六):Spinner 列表下拉选择框
展示源码主布局<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f8f9f8" andr原创 2021-10-22 09:56:22 · 403 阅读 · 0 评论 -
Android(二十五):GridView 网格视图
展示源码<GridView android:id="@+id/grid_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:numColumns="3" /><!-- Resources/layout/grid_item.xml --><?xml version="1.0" enco原创 2021-10-21 16:45:40 · 128 阅读 · 0 评论 -
Android(二十四):Adapter之BaseAdapter
展示目录样式Resources/drawable/blue_icon.xml<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="#65bcfd"/>原创 2021-10-21 14:35:14 · 150 阅读 · 0 评论 -
Android(二十三):Adapter之ArrayAdapter、SimpleAdapter
AdapterAdapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带基本ListView<ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/list"/><resources> <string-array n原创 2021-10-20 14:30:48 · 237 阅读 · 0 评论 -
Android(二十二):时间、计时器 - TextClock、DigitalClock、AnalogClock、Chronometer
展示源码Resources/drawable/hand_hour.xml<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <size android:width="20dp" android:height原创 2021-10-14 11:42:07 · 374 阅读 · 0 评论 -
Android(二十一):ProgressBar、SeekBar、RatingBar
展示目录源码主布局 Resources/layout/layout.xml<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" andro原创 2021-10-14 09:53:51 · 138 阅读 · 0 评论 -
Android(二十):ToggleButton 开关按钮 开关 Switch
展示目录源码Resources/drawable/thumb_selctor.xml<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true"> <shape> <co原创 2021-10-12 19:50:28 · 251 阅读 · 0 评论 -
Android(十九):RadioButton 单选 Checkbox 复选框
展示源码<RadioGroup android:id="@+id/rg" android:layout_width="match_parent" android:layout_height="wrap_content"> <RadioButton android:id="@+id/rb01" android:layout_width="match_parent" android:layout_heigh原创 2021-10-12 18:29:36 · 197 阅读 · 0 评论