android表情面板

In this tutorial, we’ll be discussing how to show the Settings Panel in our android application. With the introduction of Android Q, it’s possible to show a Floating Settings Menu without switching to the Settings App.

在本教程中,我们将讨论如何在我们的android应用程序中显示“设置面板”。 随着Android Q的推出,无需切换到设置应用程序就可以显示浮动设置菜单。

Android Q设置面板 (Android Q Settings Panel)

A Settings Panel is like a Bottom Sheet Floating Menu which allows us to view/edit the settings.

设置面板就像“底部浮动菜单”一样,它使我们可以查看/编辑设置。

Currently, the Settings Panel can show three different types of Settings:

当前,“设置面板”可以显示三种不同类型的设置:

  • Connectivity Settings – Mobile Data/Wifi Airplane Mode连接设置–移动数据/ Wifi飞机模式
  • Volume Settings – Change the volumes of alarm, calls notification etc.音量设置–更改警报,呼叫通知等的音量。
  • NFC – Configure NFC connection settingsNFC –配置NFC连接设置

To invoke each such setting, we need to call Intents with the specific Action Strings Constants.

要调用每个这样的设置,我们需要使用特定的操作字符串常量来调用Intent。

Following are the Action Strings for each Panel:

以下是每个面板的操作字符串:

  • ACTION_INTERNET_CONNECTIVITYACTION_INTERNET_CONNECTIVITY
  • ACTION_NFCACTION_NFC
  • ACTION_VOLUMEACTION_VOLUME

Using the above Settings Panel makes the UX much more smooth. Earlier to change settings from the current application, the user had to launch the Settings App using Intents.
Now, the transition is much more smooth.

使用上面的“设置面板”可使UX更加流畅。 要从当前应用程序更改设置,用户必须先使用Intents启动设置应用程序。
现在,过渡更加顺畅。

Despite all the pros, there is one con in this new Settings Panel Design.

尽管有很多优点,但这种新的“设置面板”设计还是有缺点的。


Why is the Settings Panel really needed when the user can access these actions from the System notification tray in the Status Bar?
当用户可以从状态栏中的系统通知托盘访问这些操作时,为什么真正需要设置面板​​?

In the following section, we’ll be implementing each of these three Settings Panel in our Android Studio Project.

在下一节中,我们将在Android Studio项目中实现这三个设置面板中的每一个。

Android Q应用内设置面板项目结构 (Android Q In-App Settings Panel Project Structure)

Android Q Settings Panel Project Structure

Android Q设置面板项目结构

Please make sure that you have updated your Android SDK and builds to the latest Android – Q.

请确保您已更新Android SDK,并已构建到最新的Android –Q。

码 (Code)

The code for the activity_main.xml layout is given below:

下面给出了activity_main.xml布局的代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android"xmlns:app="https://schemas.android.com/apk/res-auto"xmlns:tools="https://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:gravity="center"tools:context=".MainActivity"><Buttonandroid:id="@+id/btnInternet"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="INTERNET SETTINGS"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintRight_toRightOf="parent"app:layout_constraintTop_toTopOf="parent" /><Buttonandroid:id="@+id/btnVolume"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="VOLUME SETTINGS"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintRight_toRightOf="parent"app:layout_constraintTop_toTopOf="parent" /><Buttonandroid:id="@+id/btnNFC"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="NFC SETTINGS"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintLeft_toLeftOf="parent"app:layout_constraintRight_toRightOf="parent"app:layout_constraintTop_toTopOf="parent" /></LinearLayout>

The code for the MainActivity.java class is given below:

MainActivity.java类的代码如下:

package com.journaldev.androidqsettingspanel;import androidx.appcompat.app.AppCompatActivity;import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.Button;public class MainActivity extends AppCompatActivity implements View.OnClickListener {Button btnInternet, btnVolume, btnNFC;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);btnInternet = findViewById(R.id.btnInternet);btnVolume = findViewById(R.id.btnVolume);btnNFC = findViewById(R.id.btnNFC);btnInternet.setOnClickListener(this);btnVolume.setOnClickListener(this);btnNFC.setOnClickListener(this);}@Overridepublic void onClick(View view) {switch (view.getId()) {case R.id.btnInternet:showInternetSettings();break;case R.id.btnVolume:showVolumeSettings();break;case R.id.btnNFC:showNFCSettings();break;}}private void showInternetSettings() {startActivity(new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY));}private void showVolumeSettings() {startActivity(new Intent(Settings.Panel.ACTION_VOLUME));}private void showNFCSettings() {startActivity(new Intent(Settings.Panel.ACTION_NFC));}
}

The above code is self-explanatory.
We’ve simply launched each of the Settings Panel on different Button click Intents.

上面的代码是不言自明的。
我们只是在不同的按钮单击意图上启动了每个设置面板。

The output of the above application in action is given below:

上面应用程序的输出如下:

Android Q Settings Panel Output

Android Q设置面板输出

Ignore the lags and UI getting cut since it’s an issue with the Android Emulator.

忽略滞后和UI被削减,因为这是Android模拟器的问题。

That brings an end to this tutorial. You can download the project from the link below or view the full source code in our Github Repository.

这样就结束了本教程。 您可以从下面的链接下载项目,或者在我们的Github存储库中查看完整的源代码。

AndroidQSettingsPanelAndroidQSettingsPanel
Github Project LinkGithub项目链接

翻译自: https://www.journaldev.com/28036/android-q-in-app-settings-panel

android表情面板

android表情面板_Android Q:应用内设置面板相关推荐

  1. java面板的大小_JAVA编程上我定义了几个面板和一个Frame,怎么设置面板的大小???用setSize怎么没用啊?...

    JAVA编程上我定义了几个面板和一个Frame,怎么设置面板的大小???用setSize怎么没用啊? 关注:250  答案:4  信息版本:手机版 电脑版 解决时间 2021-02-04 13:23 ...

  2. 【Midjourney】Midjourney 基本操作 ① ( 使用 Midjourney 生成图片 | V 按钮继续生成 | U 按钮获取结果 | Midjourney 设置面板 )

    文章目录 一.使用 Midjourney 生成图片 1.初次生成图片 2.查看 GPU 时间消耗 3.重新生成图片 4.V 按钮继续生成 / U 按钮获取结果 二.Discord 中的 Midjour ...

  3. Android应用内设置多语言

    1.项目简介 最近项目中要加入多语言需求,涉及到的有中文简体,中文繁体,英语,西班牙语,泰语,印尼语,葡萄牙语.参考了Android应用内设置多语言,可随系统语言改变而改变,在此基础上做了修改,选择为 ...

  4. android标题白色_Android设置布局背景为白色的三种方法

    一.在xml文件里可以直接设置: android:background="#ffffff" 其他颜色可以看这里;http://blog.csdn.net/yanzi1225627/ ...

  5. android xml黑体字_Android开发之字体设置

    默认字体 Android SDK自带了四种字体:"normal""monospace","sans", "serif", ...

  6. Android 表情功能的完整处理方案

    概述 1.原理和实现思路 2.表情图片显示 3.表情面板 4.表情的输入框插入和删除 5.表情添加脚本 Android中表情功能,一般都不是用ImageView去设置图片实现的, 表情一般会嵌套在文本 ...

  7. Android高版本P/Q/R源码编译指南

           Android高版本P/Q/R源码编译指南 Android源码编译系列博客: Android.bp你真的了解吗 Android.bp入门指南之Android.mk转换成Android.b ...

  8. 【错误记录】Android Studio 的 Flutter 代码界面没有 Logcat 面板 ( 2021年08月28日最新解决方案 )

    文章目录 前言 一. 报错信息 二. 解决方案 前言 在之前的博客 [错误记录]Android Studio 的 Flutter 代码界面没有 Logcat 面板 中 , 处理了该问题 , 不过时去年 ...

  9. 【Android RTMP】x264 编码器初始化及设置 ( 获取 x264 编码参数 | 编码规格 | 码率 | 帧率 | B帧个数 | 关键帧间隔 | 关键帧解码数据 SPS PPS )

    文章目录 安卓直播推流专栏博客总结 一. x264 编码器参数设置引入 二. 获取 x264 编码器参数 三. 设置 x264 编码器编码规格 四. 设置 x264 编码器编码图像数据格式 五. 设置 ...

最新文章

  1. web.config配置
  2. 延毕率逐年上升!我国博士研究生累计招生已近150万!
  3. 框架有几层_如何设计一个自动化框架
  4. Google推出“Google实验室” Ad Innovations
  5. 实例27:python
  6. 办公OA的附件无法下载、打不开的解决办法
  7. 对《技术人员,你拿什么拯救你的生活----温水煮青蛙》的一点看法
  8. 软件更新 正在连接至服务器,正在联系iphone软件更新服务器【操作指南】
  9. reids笔记4 集群
  10. win10 微信/QQ等能听到别人说话,别人听不到自己说话解决方案
  11. veu项目中下载图片到本地
  12. 【亲测有效】Ubuntu系统开机速度慢解决办法
  13. 超越授权使用计算机,提供侵入、非法控制计算机信息系统程序、工具罪
  14. aptana手动配置python环境_Python学习1:使用Aptana构建Python开发环境
  15. git 调换提交顺序
  16. weborder什么意思_hp web是什么意思
  17. MySQL基础与navicat使用
  18. 解决方案——笔记本HDMI外接2k显示器如何调2k分辨率
  19. 关于CList的小知识
  20. 免费学习coursera的课程的操作办法

热门文章

  1. 转 java中static{}语句块详解
  2. [转帖]SQL SERVER 2005 安全设置
  3. [转载] python 动态变量创建locals()
  4. [转载] Python数据可视化库-Matplotlib——折线图绘制
  5. [转载] python将图片进行base64编码, 解码
  6. [转载] tensorflow如何微调时如何只训练后两层_XLNet只存在于论文?都替你封装好了还不来用!...
  7. [转载] python中append和extend函数区别
  8. [转载] python3.5 利用openpyxl模块来处理excel表
  9. HTML-JS-CSS基础
  10. CountDownLatch和cyclicbarrier的使用