当前位置: 首页 > news >正文

制作网站 公司企业网络推广网站

制作网站 公司,企业网络推广网站,网站被k 多久恢复,深圳市公司查询1 前言 之前在工作中,第一次听到launcher有点蒙圈,不知道是啥,当时还赶鸭子上架去和客户PK launcher的事。后来才知道其实就是安卓的桌面。本来还以为很复杂,毕竟之前接触过windows的桌面,那叫一个复杂。。。 后面查了…

1 前言

之前在工作中,第一次听到launcher有点蒙圈,不知道是啥,当时还赶鸭子上架去和客户PK launcher的事。后来才知道其实就是安卓的桌面。本来还以为很复杂,毕竟之前接触过windows的桌面,那叫一个复杂。。。

后面查了一下,Android的桌面倒是没那么复杂,本质其实就是一个App,系统启动之后跑起来的第一个app。

Android Launcher 是一个应用程序,用于显示设备的主屏幕,并且是启动其他应用的入口。简单来说,Launcher 是 Android 设备的“应用启动器”,负责管理和展示设备的主屏幕、应用图标、桌面小部件(widgets)以及应用程序的启动行为。

2 操作步骤

最近搭建了app的环境,现在借着之前搭建的环境(Android学习20 -- 手搓App2(Gradle)-CSDN博客),试着弄一个launcher。

*   The key to making your app a launcher is to declare the correct intent filter in your `AndroidManifest.xml` file. This tells the Android system that your app is capable of acting as a launcher.
*   Here's how your `AndroidManifest.xml` should look (specifically the `<activity>` tag for your

所以修改之后的AndroidManifest.xml是这样。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example.simpleapp"><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="SimpleApp"android:theme="@style/Theme.AppCompat.DayNight"><activityandroid:name=".MainActivity"android:label="SimpleApp"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /><category android:name="android.intent.category.HOME" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity></application>
</manifest>

最核心的就是在intent filter里面的配置,重点就是这几行。

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />

 * **Explanation:** *

`<action android:name="android.intent.action.MAIN" />`: This is the standard action for the main entry point of an app. * `

<category android:name="android.intent.category.LAUNCHER" />`: This category indicates that this activity should be listed in the app launcher (the list of apps). * `

<category android:name="android.intent.category.HOME" />`: This is the crucial category that tells the system this activity can act as a home screen replacement. * `

<category android:name="android.intent.category.DEFAULT" />`: This category is often used with `HOME` to ensure your app is considered a valid home screen option. * 

MainActivity.java。主界面上面就是一个按钮,点了之后会启动一个浏览器。

package com.example.simpleapp;import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);// 获取按钮控件Button openBrowserButton = findViewById(R.id.openBrowserButton);// 设置按钮点击事件openBrowserButton.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {// 启动浏览器Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));startActivity(browserIntent);}});}
}

这里就实现了前面说的启动应用程序的功能,就是通过startActivity(browserIntent);

之后要指定布局,也就是res/layout/activity_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_parent"android:orientation="vertical"android:gravity="center"><!-- 启动浏览器按钮 --><Buttonandroid:id="@+id/openBrowserButton"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Open Browser" />
</LinearLayout>

编译用之前调好的就行。

gradle wrapper
gradlew assembleDebug

编译的时候会报错,说mipmap,drawable找不到。

可以去Android Studio创建好的工程里面拷贝过来。完了大概是这样的。里面也就是一堆xml。

之后就可以顺利编过,安装也比较简单。直接运行就是这样:

3 未能最终完成。。

但是有一点很遗憾,在荣耀的平板里面,这个是叫做桌面。自己做的这个launcher,怎么都没法设置进去。除了默认的华为桌面,找不到可以设置的地方。

查了一下,有可能是我的设置还有点问题,但是大概率还是华为的平板把这部分的权限给关了。估计只有以后找一个干净的AOSP再试试了。。。 

http://www.ritt.cn/news/13576.html

相关文章:

  • 汕头市建设局造价信息网站十大电商代运营公司
  • 心理教育网站建设目的友情链接的检查方法
  • 2023年企业年报入口seo优质友链购买
  • 广东设计公司排名前十强seo搜索推广费用多少
  • 方案 网站建设长沙百度网站快速排名
  • 网站建设规划文案网址推广
  • 深圳专业网站建设多少钱可以发布推广引流的悬赏平台
  • 找钢网网站建设企业营销策略
  • 上海网络平台网站建设如何做一个自己的网站呢
  • 帝国手机网站怎么做一个免费的网站
  • 北京建王环境发展有限公司网站免费优化软件
  • 个人网站命名技巧百度网页版登录首页
  • 最好记得网站域名云优客seo排名公司
  • 网页制作与设计考试杭州网站优化平台
  • 哈尔滨网络推广专员湖南网络优化服务
  • 什么软件做高级网站足球联赛排名
  • 如何进入网站管理员界面免费建立个人网站凡科
  • 聊城冠县网站建设自动引流推广app
  • 西安排名seo公司seo网站优化工具
  • 北京做公司网站公司免费sem工具
  • 滁州市建设局网站策划方案模板
  • 手机web服务器关键词排名优化公司成都
  • 网站推广和seo软文广告平台
  • 欧美网站建设排名大全钓鱼网站制作教程
  • 苹果官方网站设计风格百度seo入驻
  • 做啤酒纸箱包装的网站百度提问首页
  • 公司做网站的费用的会计分录谷歌广告推广怎么做
  • 网站公司成本郑州靠谱seo电话
  • 网站设计的步骤武汉seo推广优化
  • 天津建站费用附近的电脑培训班在哪里