草庐IT

assets_attributes

全部标签

Android:使用 BitmapFactory.decodeStream(...) 和 Assets 文件夹时 PNG 透明度失败

我正在使用以下方法从我的Android应用程序的Assets文件夹中提取PNG文件:publicstaticBitmapgetBitmapFromAssets(Contextcontext,StringfileName){try{AssetManagerassetManager=context.getAssets();InputStreaminputStream=assetManager.open(fileName);Bitmapbitmap=BitmapFactory.decodeStream(inputStream);returnbitmap;}catch(Exceptionex)

android - 如何使用 android :layout attribute 为自定义首选项实例化布局

我可以通过android:layout属性为首选项设置合适的布局。举个例子布局在哪里我可以在PreferenceActivity的OnCreate中获取ViewPreferencefric=(Preference)this.findPreference("friction");Viewv=fric.getView(null,null);SeekBarsbFriction=(SeekBar)v.findViewById(R.id.sbFriction);sbFriction.setOnSeekBarChangeListener(this);ButtonbtnFric=(Button)v.

安卓数据绑定(bind) : can't find the setter for attribute

不确定它是如何工作的,但根据thispost可以使用不同的命名空间来绑定(bind)特定的监听器。我想对searchview做同样的事情并将QueryTextListener绑定(bind)到它,但我收到以下错误:Cannotfindthesetterforattribute'bind:setOnQueryTextListener'withparametertypeandroid.widget.SearchView.OnQueryTextListener.我在ViewModel中做了什么:publicclassMembersFragmentViewModelextendsBaseObs

php - 通过 Auth Controller 保护 Assets /媒体文件夹?拉维尔 5.2

我有公共(public)/Assets/媒体/文件夹我可以像下面这样公开访问这个文件。http://localhost/myapp/public/Asset/Media/1/phpunit.xml同样,Asset/Media文件夹中还有其他文件夹正在运行中创建。这些子文件夹中也有许多文件,Assets/媒体文件夹中也有很多文件有没有什么办法,如果我尝试访问Assets/媒体文件夹中的任何文件或Assets/媒体文件夹的子文件夹中存在的任何文件,我应该被重定向到登录页面,因为没有完成身份验证?我的意思是,我可以使用Auth中间件来保护这个文件夹吗?如果是这样,如果我们必须从Android

android - 有没有办法从 Android 的 Assets 文件夹中将文件作为 File 对象打开?

我想获取位于Assets目录中的文件的文件大小。我看到很多这样的例子InputStreammyInput=appContext.getAssets().open()我知道我可以通过简单地循环读取InputStream来确定文件大小,但我正在寻找一种通过Fileobject来完成此操作的方法。所以我需要Assets的路径,这就是我无法确定的...如何获得该路径?还尝试通过appContext.getAssets().openFd()和openNonAssetFd()但运气不好-得到了FileNotFound或可能是压缩异常。顺便说一句,developer.android.com上对这些o

android - 在 Android 中将 Assets 或原始或资源文件作为 File 对象读取

我有一个jar文件,我需要为其传递文件对象。我如何将资源或Assets作为文件对象传递给该方法?如何将项目文件夹中的Assets或原始文件转换为文件对象? 最佳答案 这是我做的:将您的Assets文件复制到SDCard中:AssetManagerassetManager=context.getResources().getAssets();String[]files=null;try{files=assetManager.list("ringtone");//ringtoneisfoldername}catch(Exceptione

Android+Maven "No resource identifier found for attribute ' installLocation' in package 'android'”

为了向我的android应用添加对installLocation的支持,我在我的IDE(IntelliJ)中将我的android级别从7提高到8。Android应用程序从IntelliJ构建良好。虽然我们使用Maven,但从Maven编译失败。[ERROR]C:\dev\svnlocal\5x\android\AndroidManifest.xml:3:error:Noresourceidentifierfoundforattribute'installLocation'inpackage'android'[ERROR]Errorwhengeneratingsources.我也添加了我

android - 错误获取 'android:label' 属性 : attribute is not a string value

在尝试将我的应用程序发布到AndroidMarket时出现此错误“获取‘android:label’属性时出错:属性不是字符串值”。前段时间这个应用程序已经在市场上成功发布,但是当我在AndroidManifest.xml中应用小的更改(更改versionCode和versionName)时,我不断收到此错误。我在这里查看了所有类似的主题,例如:AndroidMarketPublishingIssues"ERRORgetting'android:icon'attribute:attributeisnotastringvalue"whentryingtouploadtotheAndroi

android - 从 Maven 添加 facebook sdk 后出现 "Error:Attribute "样式 "has already been defined"错误

我通过以下方式通过Maven添加了facebookSDK:compile'com.facebook.android:facebook-android-sdk:3.21.1'当我编译时,我在\app\src\main\res\values\colors.xml文件中收到错误错误:属性“style”已被定义有什么建议吗?这很令人费解。Gradle:applyplugin:'com.android.application'android{compileSdkVersion21buildToolsVersion'21.1.1'defaultConfig{applicationId'com.ra

android - 重新打包 APK 文件以包含自定义 Assets - 使用什么构建工具?

更新:这是一篇旧帖子,下面对损坏的aapt版本的引用将过时。根据之前的反馈,我将自定义文本字段存储在我应用的Assets目录中。我将使用Assets文件中的默认用户详细信息编写应用程序,客户希望为每个用户重建应用程序,包括Assets文件中该用户的详细信息。(我知道这种方法有一些严重的缺点,但客户仍然热衷于这样做-参见EmbedlogindetailsinAPKfile,differentforeachuser(orotheroptions?))这个问题与我在解压缩APK文件并更新自定义Assets文件后重建APK文件时遇到的问题有关。我确信我遗漏了一些小东西,但是,我找到的关于这些方