android 相关问题

Android是谷歌的移动操作系统,用于编程或开发数字设备(智能手机,平板电脑,汽车,电视,磨损,玻璃,物联网)。对于与Android相关的主题,请使用特定于Android的标签,如android-intent,android-activity,android-adapter等。对于开发或编程以外的问题,但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。

tradefed 和 vts-tradefed 有什么区别?

我在网上寻找有关如何编写自己的 VTS 测试并通过 Tradefed 运行它们的示例,并找到了这篇文章:https://source.android.com/docs/core/tests/tradefed/fundamentals/full_example 。但是

回答 1 投票 0

使用 Expo 字体进行原生反应,不加载自定义字体

我目前正在尝试为我的应用程序加载自定义字体。 iOS 的字体加载正确,但 Android 上出现以下错误 [错误:方法或属性 expo-file-system.downloadAsync 不是

回答 1 投票 0

为什么应用程序显示名称在 iOS 上被截断

第一个问题: 我的 iOS 应用程序显示名称有问题。我尝试了很多解决方案,阅读了很多讨论,终于设法在 CFBundleDisplayName 中添加空间,但我仍然无法理解......

回答 1 投票 0

Android系统源码中如何修改最小宽度的值

我有一个Android系统的源代码,我想对其进行修改,以便可以自定义开发者选项下绘图的最小宽度值 大多数答案我...

回答 1 投票 0

.NET MAUI - 地图控件加载和 MoveToRegion 方法未按预期工作

我正在尝试在页面的一部分中使用 Microsoft.Maui.Controls.Maps 实现 Google Maps 地图,该部分仅在按下按钮时显示。我在移动

回答 1 投票 0

Android如何设置BottomSheetDialogFragment与系统导航栏颜色相同?

我试图使我的 BottomSheetDialogFragment 和底部导航颜色为相同的颜色。设置导航栏的颜色效果很好,因为我将其设置为白色,但是按钮的颜色...

回答 2 投票 0

我更改了默认的 MainActivity

你好我想更改默认活动。但是当我这样做时,应用程序根本无法启动,没有任何错误 开始: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHE...

回答 1 投票 0

将Image作为子项放入ListView中会导致软件崩溃

我正在使用.net maui开发一个漫画软件,我的主要平台是Android。这是我的代码。 我正在使用.net maui开发一个漫画软件,我的主要平台是Android。这是我的代码。 <ListView x:Name="listView" HasUnevenRows="True" IsPullToRefreshEnabled="False" ItemsSource="{Binding ImageUrls}" SelectionMode="None" SeparatorVisibility="None"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <Grid> <Image x:Name="img" Source="{Binding}" /> <Label FontFamily="" HeightRequest="600" HorizontalOptions="Center" HorizontalTextAlignment="Center" IsVisible="{Binding IsLoading, Source={x:Reference img}}" Text="loding..." TextColor="Black" VerticalTextAlignment="Center" /> </Grid> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> 这是加载图像时的问题。当加载的图像太大时,它们会抛出Java.Lang.RuntimeException:'Canvas:尝试绘制太大(109224768bytes)位图。'和崩溃。通过关闭应用程序硬件加速或关闭以适应不同的屏幕密度来修复此问题,但它降低了滑动的平滑度,这似乎有点成本,不知道是否有更好的方法。 <application android:hardwareAccelerated="false" android:largeHeap="true" ... /> <supports-screens android:anyDensity="false" /> (刚才发现这个问题与Image控件无关,而是在特定图像和可滚动视图(例如ScrollView、ListView、CollectionView)的双重影响下产生的。比如这张图https://s1.baozicdn.com/scomic/woduzishengji-duburedicestudio/0/1-7ymq/24.jpg 有问题 而https://s1.baozicdn.com/scomic/woduzishengji-duburedicestudio/0/1-7ymq/25.jpg等其他图片是没有问题的,如果给Image加上Margin="0,0,0,200",或者Image没有放在ListView中,而是放在StackLayout中,则不会出现异常) 如果有人愿意提供帮助,我将不胜感激 查了很多资料都没有找到好的解决办法 您可以尝试将 android:anyDensity 属性添加到文件AndroidManifest.xml,如下所示: <manifest ... > <supports-screens android:anyDensity="false" android:xlargeScreens="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" /> </manifest> 参考链接

回答 1 投票 0

Android Dagger 可以协助将包含字符串的类注入到提供的改造实例中吗?

这里我有一个类,最初是一个带注释的注入类,名为 AppConfig 类 AppConfig @Inject 构造函数() { val configBaseURL1 : 字符串 = "baseURL1" val configBa...

回答 1 投票 0

Android NavHost:“在导航图中找不到与请求 NavDeepLinkRequest 匹配的导航目的地”

这是我的相关代码,用 Kotlin + Jetpack Compose 构建: OutlookPlannerNavHost.kt /** * 为应用程序提供导航图。 */ @可组合 有趣的 OutlookPlannerNavHost( 导航控制...

回答 1 投票 0

Android TV 应用被拒绝,原因是“没有全尺寸应用横幅和/或图标”

我知道这不是一个与编程相关的问题,但我们在尝试更新 Google Play 上现有的电视应用程序时感到有点沮丧。 谷歌审查了该应用程序并拒绝了它,尽管它是......

回答 1 投票 0

如何在我的适配器 Firestore Recyclerview 上正确设置 setOnClickListener

我需要在我的适配器中为我的RecyclerView(firestore)设置一个setonclick侦听器,我要在点击时显示的活动是RestaurantDetails,我需要点击餐厅卡并被引导到...

回答 1 投票 0

编写排除配置以进行依赖性检查

我在我的Android项目中使用https://github.com/dependency-check/dependency-check-gradle。 我想排除这些依赖项的地方 ant-1.10.9.jar (pkg:maven/org.apache.ant/[email protected], cpe:2.3:a:

回答 1 投票 0

无法找到flutter doctor的android SDK

我已经尝试在计算机上卸载并重新安装 flutter 两次,但每当我在终端中运行 flutter doctor 时,我仍然会遇到以下错误。 [✗] Android 工具链 - 为

回答 8 投票 0

使用NDK构建简单的cpp文件,无需android studio

如何使用 android ndk 构建用 C++ 编写的简单 helloworld 代码: 我想构建的代码示例: https://github.com/Ylarod/ndk-vscode 我在Windows上下载的NDK: https://developer.android...

回答 1 投票 0

@JavascriptInterface 中的Webview.loadurl 会使应用程序崩溃

我有一个 webview,它在主线程上运行,我正在调用 webview.loadurl("https://www.google.com") 其加载良好。 webview 有以下设置,因此 javascript 函数调用...

回答 3 投票 0

Android 照片在图像视图中,质量很差

我允许用户拍照,我得到这张照片并将其设置在图像视图中。 这是我的 imageview 的代码: 我允许用户拍照,我得到这张照片并将其设置在图像视图中。 这是我的图像视图代码: <ImageView android:id="@+id/photo1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:scaleType="centerCrop" android:adjustViewBounds="true" android:layout_marginBottom="2dp" /> 我的代码将照片放入此图像视图中: imgPhoto1.setImageBitmap(btmap); 我的问题是,照片显示模糊...... 如何才能拥有“正确”的品质? 我尝试使用这个: getWindow().setFormat(PixelFormat.RGBA_8888); 但它什么也改变不了。 谢谢, 编辑:请,如果可能的话,我正在寻找一个不使用库的解决方案,它仅适用于两个图像视图.. 编辑2:好的,没有库似乎是不可能的,因为我的图像占据了屏幕上的所有可用空间。 此功能解决了ImageView中图片质量不好的问题: public static Bitmap getBitmapFromResources(Resources resources, int resImage) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = false; options.inDither = false; options.inSampleSize = 1; options.inScaled = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; return BitmapFactory.decodeResource(resources, resImage, options); } 还有imageView.setImageBitmap(getBitmapFromResources(getResources(), R.drawable.image)); 使用通用图像加载器或 picasso 代替加载位图: Android 通用图像加载器 毕加索 为什么要使用Android Picasso库下载图片? 您还可以使用AndroidQuery。它还允许您异步加载图像。我从来没有遇到过质量问题。它非常易于使用,还允许您缓存图像。 https://code.google.com/p/android-query/ 更改你的imgview宽度和高度样式 <ImageView android:id="@+id/photo1" <!--android:layout_width="match_parent"--> <!--android:layout_height="match_parent"--> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:scaleType="centerCrop" android:adjustViewBounds="true" android:layout_marginBottom="2dp" /> 希望有帮助 您想要获取照片的 URI,而不是位图预览。 在 onCreate() 之外 private lateinit var photoUri: Uri 在相机权限检查中。使用这个功能拍照就可以了 private fun takePic() { val permissionCheck = ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) if (permissionCheck == PackageManager.PERMISSION_GRANTED) { if (takePictureIntent.resolveActivity(packageManager) != null) { val photoFile: File? = try { createImageFile() } catch (ex: IOException) { ex.printStackTrace() null } photoFile?.also { photoUri = FileProvider.getUriForFile( this, "com.example.myapp.fileprovider", it ) takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri) startActivityForResult(takePictureIntent, Permission.REQUEST_IMAGE_CAPTURE) } } } } 生成图像文件并检索其 URI 的函数。 private fun createImageFile(): File { // Create an image file name val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) val storageDir: File? = getExternalFilesDir(Environment.DIRECTORY_PICTURES) return File.createTempFile( "JPEG_${timeStamp}_", ".jpg", storageDir ) } 在你的 onActivityResult() 上 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) when(requestCode){ Permission.REQUEST_IMAGE_CAPTURE -> { if (resultCode == Activity.RESULT_OK) { // Load the full-quality image into ImageView val imageView = findViewById<ImageView>(R.id.photo) imageView.setImageURI(photoUri) } } } } 修改你的AndroidManifest.xml并在里面添加 <provider android:name="androidx.core.content.FileProvider" android:authorities="com.example.myapp.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider> 并在 res/xml 上创建一个名为 file_paths.xml 的 xml 文件 <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-files-path name="my_images" path="Pictures/"/>

回答 5 投票 0

在 Flutter/Android 构建上找不到 protoc-3.9.2-osx

我正在开发一个 Flutter 应用程序,它集成了使用 Protobuff 的本机包。我在 Android Studio 和 Mac(Apple 操作系统)上工作。 在 Windows 上,应用程序构建,但由于我工作......

回答 4 投票 0

反对重建 APK 失败

我尝试在 Android 应用程序中使用 Objection,每次我尝试使用 patchapk 重建都会失败,并出现以下错误: 重建 APK 可能失败。阅读以下输出以阻止...

回答 1 投票 0

什么时候需要在 Android 小部件或应用程序中使用 singleTop launchMode?

我刚刚被一个小部件烧伤了。我可以看到问题的原因,但无法确定原因或解决方案。我的小部件正在发出搜索 (SearchManager) 并且该活动启动了搜索

回答 2 投票 0

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