android-resources

Trying to use <!ENTITY in ANDROID resources with error: “The entity was referenced, but not declared.”

依然范特西╮ 提交于 2019-11-27 02:35:30
问题 I'm following this solution to use enetities in my string resource file: Is it possible to do string substitution in Android resource XML files directly? I'm using an external file in the resource tree: /res/raw/entities.dtd , its content: <!ENTITY ent_devicename "MyDeviceName"> In the string.xml resource file: <!DOCTYPE resources [ <!ENTITY % ent_devicename SYSTEM "../raw/entities.dtd"> %ent_devicename; ]> <resources> <string name="name">The name is &ent_devicename;</string> </resources> but

Localizing string resources added via build.gradle using “resValue”

旧巷老猫 提交于 2019-11-27 02:15:27
问题 This is in continuation to an answer which helped me on this post We can add the string resource as follows from build.gradle : productFlavors { main{ resValue "string", "app_name", "InTouch Messenger" } googlePlay{ resValue "string", "app_name", "InTouch Messenger: GPE Edition" } } It works like a charm and serves the purpose of having different app names per flavor. (with the original app_name string resource deleted from strings.xml file. But, how do we add localized strings for this

Detect fling gesture over clickable items

血红的双手。 提交于 2019-11-27 01:48:25
问题 Imagine a layout with 4 buttons _______________________________ | | | | A | B | |______________|________________| | | | | C | D | |______________|________________| I'd like to detect the fling gesture over the whole layout but when the fling starts over a button is no detected. I'm using: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); gesturedetector= new GestureDetector(this, this); findViewById(R.id.touchContainer)

Fast ways to import drawables in Android Studio?

£可爱£侵袭症+ 提交于 2019-11-27 01:06:34
At some point in an Android project you will need to import some drawables - be it toolbar icons, images, UI features - in res/drawable directory. Most of the times you have images scaled for the most common qualifiers ( drawable-hdpi , drawable-mdpi , drawable-xdpi , drawable-xxdpi , ...). So we need to do three, four, even five file copy/pastes for each drawable: external_dir/drawable-mdpi/file.png -> my_package/drawable-mdpi/file.png external_dir/drawable-hdpi/file.png -> my_package/drawable-hdpi/file.png external_dir/drawable-xdpi/file.png -> my_package/drawable-xdpi/file.png external_dir

Android Studio: Creating landscape layouts

血红的双手。 提交于 2019-11-27 01:00:35
Until recently I used Eclipse, and in Eclipse I simply created a folder /res/layout-landscape and put alternate landscape layouts inside. However, it seem in Android Studio 1.1.0, I can't do it that way. How do I create the folder for alternate landscape layouts? You can actually use layout-land in Android Studio as well it will show up in your res directory like so: If it doesn't show up make sure to have your project scope set to Project and not Android . If you still don't see one you can create one by right clicking on the res directory and selecting New -> Android resource directory and

Store static data in Android - custom resource?

回眸只為那壹抹淺笑 提交于 2019-11-27 00:51:58
问题 I'm new to Android development, and I've been playing around with it a bit. I was trying to create a program that has a small database-like collection of never-changing data. In C#, my currently best language, I'd use a List of a custom class and serialize that to an xml file, then read that into my application at runtime. I found the /xml resource folder in Android, but I'm not sure how I would go about doing what I'm envisioning. What would be the best way to go about doing this? The data

Android Studio 3.1 Cannot Resolve Symbol (Themes, Widget, attr, etc.)

僤鯓⒐⒋嵵緔 提交于 2019-11-27 00:34:11
I upgraded Android Studio today to 3.1, and now Android Studio says it cannot resolve symbols for most of the resources (for example ThemeOverlay in styles.xml or ?attr/actionBarSize ). This doesn't seem to prevent me from building or running in an emulator so far, but these errors are making me nervous. Has anyone else experienced this issue? How can I go about resolving it? I have tried syncing gradle and cleaning my project but it doesn't seem to help at all. Any ideas? I'm using Android Studio 3.1 with Gradle version 4.4 and Gradle Plugin 3.1.0 EDIT: This issue affects updating to Android

Gradle finished with non-zero exit value 1 (ic_launcher.png: error: Duplicate file)

落爺英雄遲暮 提交于 2019-11-26 23:54:39
I got this strange error with gradle, please help me! /.../app/build/intermediates/res/debug/drawable-xxhdpi-v4/ic_launcher.png: error: Duplicate file /.../app/build/intermediates/res/debug/drawable-xxhdpi/ic_launcher.png: Original is here. The version qualifier may be implied. Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/.../sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1 Before it was operating normally, but since I put classpath com.android.tools

Android XXHDPI resources

五迷三道 提交于 2019-11-26 23:45:26
The Google Nexus 10 comes out shortly, and is the first device to use xxhdpi resources . It sports a display density of about 300 DPI (according to the Nexus 10 website and this calculator ). However, when I go to the Android documentation, it states: ldpi : ~120dpi mdpi : ~160dpi hdpi : ~240dpi xhdpi : ~320dpi xxhdpi is not specified. How come the Nexus 10's 300 DPI screen is xxhdpi instead of xhdpi , and what should be the approximate DPI of xxhdpi ? Should we even worry about having new resources (aside from icons) for xxhdpi at this point, or should we just let the OS scale up xhdpi

Packaging Android resource files within a distributable Jar file

本小妞迷上赌 提交于 2019-11-26 23:24:18
I am working on some reusable Android code that I would like to distribute to other developers for use within their own applications. The code has some resource dependencies (layouts, xml & png drawables) that I would like to be able to include and reference within a single package (Jar file). Is this possible, and if so what is the best method to do this? I don't have any optimistic news for you. In general you cannot distribute your own package as easily as you would expect. The main problem is the autogenerated R file. You probably make some references to it - you have your layouts and