如何访问平时APK文件Res目录下的内容呢? 如果直接访问Apk下的assets目录可以使用AssetManager类处理,而需要访问res/raw这样的文件夹怎么办呢? APK在安装时已经解压缩,部分资源存放在/data/data/package_name/这里, 比如我们想访问res/raw/android123.cwj文件,可以使用android.resource://package_name/" + R.raw.android123 这个Uri,其中package_name是你工程的包名。
完整的处理代码为 Uri uri = Uri.parse("android.resource://com.android123.Sample/raw/android123.cwj"); 即可使用工程res/raw目录下的文件了。
原文链接 :http://hi.baidu.com/zhoutianyang/blog/item/1a4d56df5979551f485403de.html
A Uri object can be used to reference a resource in an APK file. The Uri should be one of the following formats:
分享到:
相关推荐
可以将apk安装包res目录内的文件重命名为0.png、1.png、a.9.png、A.xml...可一定程度上减少安装包体积 使用方法:拖apk文件到AndroidResProguard.bat,成功将生成xxx_r.apk,xxx_mapping.txt 注意:目前未经大量...
(2)修改layout目录下的xml布局文件,添加3个按钮空间和一个文本控件,用于提示当前播放状态和 播放暂停 停止等功能。具体代码如下 <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android ...
不错的android冗余图片、冗余布局的清理工具,希望对大家有帮助呀!
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@ id/item_one" android:layout_width="match_parent" android:layout_height="wrap_content" leon:leftIcon="@drawable/history" leon:...
android-art-res, 在android开发的研究艺术中,源代码 android-art-res
我个人认为 ,李刚的疯狂android讲义 讲的比较详细的,还有两个实战项目,以下是与代码对应的本书目录 第1章 Android应用与开发环境 1.1 Android的发展和历史 1.1.1 Android的发展和简介 1.1.2 Android平台架构...
[Logo] (https://github.com/jainakhil88/android-commons/blob/master/sample/Android8/res/drawable-mdpi/ic_launcher.png) Android Commons Android Commons aims to provide quick, easy and ready to use set ...
第一步,复制该项目res目录下包含dimens.xml的velues文件夹到自己的项目的res目录下,其中values文件夹只复制其dimens.xml文件 直接在项目中引用, px / 密度 = dp(通常密度为2,例:10px / 2 = 5dp) 可...
xmlns:app="http://schemas.android.com/apk/res-auto" Then you can add GradientIconView in layout.xml The GradientIconView can gradient change itself from top_icon to bottom_icon. GradientIconView will...
我们在res/xml 目录下新建一个idcard_keyboard.xml文件。 这里主要介绍一些常用的类属性,更多请参考andorid官网。 Keyboard类:存储键盘以及按键相关信息。 android:horizontalGap 按键...
得到了帧文件后我们可以就编写代码,在res目录下新建anim动画文件夹,对应的item 为顺序的图片从开始到结束,duration为每张逐帧播放间隔,oneshot 为false 代表循环播放,设置为true 即播放一次即停止。具体代码...
一行代码实现沉浸式,适配android4.4到8.0 ,沉浸式前所未有的简单。 代码示例 public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { ...
LeetCode-Sol-Res This repository contains solutions and resources for LeetCode algorithm problems. The solutions are derived from my own thinking and the discussion. They are cleaned and optimized ...
Android Studio:在项目的根目录下build.gradle里的allprojects下添加如下引用: allprojects { repositories { ... maven { url 'https://jitpack.io' } } } 然后在app目录下 build.gradle 下添加依赖 ...
AndroidRTC WebRTC Live Streaming An Android client for ProjectRTC. It is designed to demonstrate WebRTC video calls between androids and/or desktop browsers, but WebRtcClient could be used in other ...
Android开发在所难免的就是UI的预览和调整,一般情况下都是直接run看效果,或者是使用AS的preview预览,但这同样带来个小问题,就是你的测试内容会跟随着代码被打包到apk中,如果没做容错的处理很有可能将测试内容...
Android hardcoding extraction tool Extraction string and dimens from layout,Merge into strings.xml and dimens.xml Download Usage > Programs description > > Programs purpose: fixed Android project ...
2)先写页面在res->layout目录下新建两个layout xml file activity_main作为主页面,msg_item为附在其上的消息页面。(具体代码见文末) 这里再acitvity_main采用的不是ListView而是RecyclerVie
xmlns:swagpoints="http://schemas.android.com/apk/res-auto" android:id="@ id/seekbar_point" android:layout_width="match_parent" android:layout_height="340dp" android:layout_gravity="center" ...
Android Shortcuts Example app for shortcuts in design library v25 Demo Manifest Add meta-data before `````` tag in Manifest.xml Add Shortcut To add or edit a new shotcut, go to /res/xml/shortcuts....