android-intent 相关问题

关于实际和高级使用Intent,Intent Extras和Pending Intents以启动活动,服务或通过BroadcastReceiver响应系统或应用程序事件/通知的问题。 (参考基本熟悉信息)

如何使用Notification.deleteIntent

我正在尝试检测我的通知何时被清除。我的问题直接涉及这个答案,它概述了我应该做什么。这就是我实施这些行动的方式: // 通常的通知...

回答 4 投票 0

与其他应用程序的自定义图像共享对话框

我有一个可以共享和接收来自其他应用程序的图像的应用程序。我这里有两个问题 在分享来自其他地方的图像时,假设我的应用程序正在显示图库,但其整个包...

回答 3 投票 0

Android Studio 上的 kotlin 意图不起作用

我正在为 kotlin 应用程序开发一个演示,这些活动单独工作,但是当我尝试将它们与意图链接起来时,ntn 正在响应应该将您发送到下一个活动的按钮...

回答 2 投票 0

Android Gallery 总是向 onActivityResult 返回 RESULT_CANCELED

首先,这不是经常发布的过早返回结果代码的问题。在这种情况下,只有在图库中选择项目后才会返回它。 在我的测试用例中我...

回答 4 投票 0

通过单击浏览器链接触发 WhatsApp 意图

我使用 Chrome 通过点击浏览器中的链接来触发意图: 塔...

回答 2 投票 0

自 Android 13 起无法启动任意 Activity

我构建了一个小型个人应用程序,它允许我为不同的 URL 指定不同的浏览器。在 Android 13 之前,它运行良好,但在 Android 13 之后的某个时候,它开始失败......

回答 6 投票 0

三星 Z Fold 5 升级到 Android 14 后出现 Intent 无限循环

所以我有一个闪屏活动,1 秒后就会出现欢迎活动,它在其他设备上运行良好,除了这款三星 z Fold 5,它刚刚获得 Android 14 更新和 One UI 6。我已经

回答 1 投票 0

意图已贬值,有什么替代方案?

我是新的 Android 开发人员,我正在 SDK 28 和 minSdkVersion 22 中构建一个应用程序。 使用另一个应用程序的代码片段,我现在收到警告消息: “android.content.intent”已弃用。 我...

回答 2 投票 0

Context.startForegroundService() 没有在计划的 AlarmClockInfo 上调用 Service.startForeground() 错误,而现有服务已经存在

TLDR:如果计划的alarmClockInfo(PendingIntent)打开一个服务实例,而应用程序通过context.bindService()位于前面并带有一个活动服务实例... 并且警报没有触发...

回答 1 投票 0

即使我没有通过意图发送任何数据,我也会收到此错误:FAILED BINDER TRANSACTION

这就是我进入第二个活动的方式: @覆盖 公共无效onEpisodeClicked(@NonNull ModelEpisode modelEpisode){ startActivity(new Intent(requireActivity(), MainActivity.class)); }

回答 1 投票 0

Android Kotlin:应用程序无法读取 NFC 标签

我最近创建了一个 NFC 标签读取器应用程序,但不幸的是,我的应用程序似乎无法识别它,但它被系统(移动)软件检测到并重定向到内置 NFC 扫描仪。我已经

回答 1 投票 0

为什么我的意图在活动之间传递对象时返回空对象?

我试图通过按钮在活动之间传递connectionHelper对象。这是我的第一个活动 LoginPanelActivity.java this.forgotPassword.setOnClickListener(new View.OnClickListener() { ...

回答 1 投票 0

iOS 17.2 破坏了 AppIntents 和快捷方式

我有一个严重依赖 AppIntents 和快捷方式的应用程序,似乎最新的 iOS 更新破坏了这些,但我不太清楚问题出在哪里。就是无论我的参数是什么

回答 1 投票 0

Android:从代码更新应用程序时无法测量 fs-verity,错误号 1

我正在尝试向我的 android 应用程序添加一项功能,以通过新版本的 apk 的外部链接进行自我更新。 我正在从外部链接下载一个 apk(我上传了我的应用程序的新版本),而不是我正在使用

回答 1 投票 0

我指定的 TextView 意图问题应用程序不断崩溃

每当我运行我的应用程序时,它都工作正常,但是一旦我单击分配的 Textview 以意图执行另一个 Activity,我的应用程序就会崩溃。 按钮积压; TextView 电子名称,约会名称; @覆盖 保护...

回答 2 投票 0

如何以我的应用程序作为源创建 Spotify 深度链接

例如,deepLink 等于spotify:app:com.example.name:playlist:37i9dQZEVXbdGwWzuKJrad,就像这里的旧示例一样。它只是打开 Spotify,没有目标播放列表。我们可以将源应用程序附加到 sp...

回答 1 投票 0

在运行时捕获/拦截 Android Intents

有没有办法在不修改Android框架的情况下在运行时捕获/拦截应用程序的Intent? 修改Android框架可能需要太多工作。 请帮助我。

回答 2 投票 0

在Android中从Service启动Activity

安卓: 公共类 LocationService 扩展服务 { @覆盖 公共无效onStart(Intent意图,int startId){ super.onStart(意图, startId); startActivity(新意图...

回答 12 投票 0

Android Intent ACTION_VIEW 无法从外部 SD 卡打开文件

当用户选择文件时会触发此代码... 公共静态无效openFiles(文件文件,上下文上下文){ Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID,...

回答 1 投票 0

Android 在视图之间绘制水平线

我的布局如下: 我的布局如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="Twitter Feeds" android:textStyle="bold" /> <ListView android:id="@+id/list" android:layout_width="350dp" android:layout_height="50dp" /> <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="1dp" android:text="FaceBook Feeds" /> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> </LinearLayout> 我的要求是在TextView和ListView之间画一条水平线 有人可以帮忙吗? 它将在 TextView 和 ListView 之间绘制银灰色线 <TextView android:id="@+id/textView1" style="@style/behindMenuItemLabel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="1dp" android:text="FaceBook Feeds" /> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#c0c0c0"/> <ListView android:id="@+id/list1" android:layout_width="350dp" android:layout_height="50dp" /> 您应该使用新的轻量级视图Space来绘制分隔线。 如果您使用 Space 而不是 View,您的布局加载速度会更快。 水平分隔线: <android.support.v4.widget.Space android:layout_height="1dp" android:layout_width="match_parent" /> 垂直分隔线: <android.support.v4.widget.Space android:layout_height="match_parent" android:layout_width="1dp" /> 您还可以添加背景: <android.support.v4.widget.Space android:layout_height="match_parent" android:layout_width="1dp" android:background="?android:attr/listDivider"/> 使用示例: .... <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="One"/> <android.support.v4.widget.Space android:layout_height="match_parent" android:layout_width="1dp" android:background="?android:attr/listDivider"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Two"/> <android.support.v4.widget.Space android:layout_height="match_parent" android:layout_width="1dp" android:background="?android:attr/listDivider"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Three"/> .... 为了使用Space,您应该在build.gradle中添加依赖项: dependencies { compile 'com.android.support:support-v4:22.1.+' } 文档https://developer.android.com/reference/android/support/v4/widget/Space.html 在布局中要分离的视图之间添加类似的内容: <View android:id="@+id/SplitLine_hor1" android:layout_width="match_parent" android:layout_height= "2dp" android:background="@color/gray" /> 希望有帮助:) 创建一次并在需要的地方使用它是一个好主意。 将其添加到您的 styles.xml 中: <style name="Divider"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">1dp</item> <item name="android:background">?android:attr/listDivider</item> </style> 并将其添加到需要行分隔符的 xml 代码中: <View style="@style/Divider"/> 最初由 toddles_fp 回答这个问题:Android Drawing Separator/Divider Line in Layout? 试试这个 <View android:layout_width="match_parent" android:layout_height="2dp" android:background="?android:attr/listDivider"/> 多年之后,终于有一个合适的视图可以在 XML 布局上显示分隔符/分隔线/水平线。为 Android 开发 Material Components 的团队已发布版本 1.5.0-alpha01,其中添加了 MaterialDivider 类。这允许向布局添加分隔线,如前所述。 首先,在 build.gradle 中添加以下内容: implementation 'com.google.android.material:material:1.5.0-alpha01' 然后,在 XML 布局上您可以编写: <com.google.android.material.divider.MaterialDivider android:layout_width="match_parent" android:layout_height="wrap_content"/> 瞧,你有一个分隔器。如果你想自定义分隔线的颜色,有一个xml属性:app:dividerColor。此视图还允许通过样式设置主题。欲了解更多信息,您可以查看此链接。 <View android:id="@+id/view" android:layout_width="match_parent" android:layout_height="2dp" android:background="#000000" /> 对 Bhoomika 接受的答案进行了改进,以获得更精美的外观: <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/black" android:alpha="0.1"/> android:alpha 用于设置视图的不透明度。 您可以将此视图放在您的视图之间来模仿线条 <View android:layout_width="fill_parent" android:layout_height="2dp" android:background="#c0c0c0"/> 试试这个对我有用 <View android:layout_width="1dp" android:layout_height="match_parent" android:background="@color/tw_composer" /> 创建水平线 如果您正在使用 TextView,然后您想放置一行,则使用 View 这样你就可以使用任何颜色,如蓝色、红色或黑色提及背景颜色。 <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/black"></view> 在您希望组件之间有分隔线的每个父级 LinearLayout 中,添加 android:divider="?android:dividerHorizontal" 或 android:divider="?android:dividerVertical。 根据您的LinearLayout的方向在它们之间选择合适的。 据我所知,这个资源样式是从Android 4.3开始添加的。 试试这个 <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@android:color/darker_gray"/> ---->简单的一个 <TextView android:layout_width="match_parent" android:layout_height="1dp" android:background="#c0c0c0" android:id="@+id/your_id" android:layout_marginTop="160dp" /> 可以指定背景颜色的视图(高度=几个 dpi)。 查看真实代码,它是: <LinearLayout android:id="@+id/lineA" android:layout_width="fill_parent" android:layout_height="2dp" android:background="#000000" /> 请注意,它可以是任何类型的 View。 如果您不想仅使用额外的视图来显示下划线。在您的 textView 上添加此样式。 style="?android:listSeparatorTextViewStyle" 缺点是它会添加额外的属性,例如 android:textStyle="bold" android:textAllCaps="true" 您可以轻松覆盖它。 对我有用的是 <view android:layout_below="@+id/kaimla_number" android:layout_width="match_parent" android:layout_height="3dp" android:background="@color/golden"></view> <view android:id="@+id/blackLine" android:layout_width="match_parent" android:layout_height="1dp" android:background="#000000" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"/> 应用程序:layout_constraintStart_toStartOf =“父”/> 使用此视图标签,您可以水平或垂直地创建视图,只需更改高度和宽度即可使其水平和垂直。您可以简单地创建水平和垂直线。 这是水平线代码,其中视图的高度是线的厚度。 <View android:id="@+id/view" android:layout_width="match_parent" android:layout_height="1.5dp" android:layout_marginHorizontal="24dp" android:layout_marginTop="20dp" android:background="@color/green" app:layout_constraintTop_toBottomOf="@id/imgChoice" />

回答 19 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.