我的 Android应用程序中有很多图像,并且试图将它们组织在assets目录下的文件夹中,而不是将它们放在drawable目录中. 我的问题是如何通过XML访问资产目录.例如: ImageView android:id="@+id/image
我的问题是如何通过XML访问资产目录.例如:
<ImageView android:id="@+id/image_team_logo"
android:src="/assets/teamlogos/ARI"
android:layout_height="25dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_width="296dp" android:scaleType="matrix"/>
不行.我可以在src字符串中放置一些东西来使其工作吗?或者只能使用代码中的AssetManager访问资产.
你为什么不把你的图像放在“drawable”-Recourse文件夹中?这就是他们所属的地方.然后可以使用以下内容以XML格式访问这些图片:<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/your_file"
/>
使用AssetManager访问位于“assets”-Folder中的文件,该文件在所需文件上返回InputStream.我不知道通过XML访问它们的方法.
