android-resources

Reference String Resource in custom XML Resource

馋奶兔 提交于 2021-02-19 02:24:28
问题 In the assets folder of my Android App Project I am storing custom XML files which describe actions in my game. Since they are a little more complex, they can not be directly written as Android Resources. Update: I am storing my custom (complex) XML files in the res/xml folder now. Simple Example: <dialog> <npc>1</npc> <text>Hello! How are you?</text> </dialog> What I want is to use the convenient advantages of Android String resources for language localisation. In the example above, I want

Getting error “file name must end with .xml” while using the “android:fontFamily” of Android O?

自闭症网瘾萝莉.ら 提交于 2021-02-17 21:15:11
问题 Android O introduces a new feature, Fonts in XML, which lets you use fonts as resources. And I am creating the font folder in resource file as it provided by Android developer, but the problem is that I am getting error that file name must end with .xml while using the font folder which is provided in Android O release. Please check the below layout for it. <TextView android:id="@+id/txtMsgCount" android:layout_width="wrap_content" android:layout_height="16dp" android:background="@drawable

Open res or assets folder with Intent.ACTION_PICK or Intent.ACTION_GET_CONTENT

天涯浪子 提交于 2021-02-11 14:15:01
问题 I want to start a file picker with Intent.ACTION_PICK or Intent.ACTION_GET_CONTENT . The user is supposed to be navigated directly to the apps resources folder or assets folder. Is this possible at all? Do I have to build my own filepicker? 来源: https://stackoverflow.com/questions/64634776/open-res-or-assets-folder-with-intent-action-pick-or-intent-action-get-content

Cannot set the default language in Android Studio

六眼飞鱼酱① 提交于 2021-02-07 06:17:36
问题 I am getting warnings in Android Studio about untranslated strings - it is telling me they have not been translated to English. This appears to be because I have an "en-rGB" resource folder. But I have tried to follow the instructions in lint to specify the default language, but this has not worked. I have the following strings.xml files: values/strings.xml : <resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en"> <string name="string1">Howdy</string> <string name=

Cannot set the default language in Android Studio

不羁岁月 提交于 2021-02-07 06:17:30
问题 I am getting warnings in Android Studio about untranslated strings - it is telling me they have not been translated to English. This appears to be because I have an "en-rGB" resource folder. But I have tried to follow the instructions in lint to specify the default language, but this has not worked. I have the following strings.xml files: values/strings.xml : <resources xmlns:tools="http://schemas.android.com/tools" tools:locale="en"> <string name="string1">Howdy</string> <string name=

How to copy element from one xml to another xml with python

余生长醉 提交于 2021-02-04 21:32:22
问题 I have 2 xmls (they happen to be android text resources), the first one is: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="TXT_T1">AAAA</string> </resources> and the second is <?xml version="1.0" encoding="utf-8"?> <resources> <string name="TXT_T2">BBBB</string> </resources> I know the attribute of the element that I want to copy, in my example it's TXT_T1. Using python, how to copy it to the other xml and paste it right behind TXT_T2? 回答1: lxml is the king of xml parsing. I

Change Language for Xamarin Android App using Resources

落爺英雄遲暮 提交于 2021-01-29 05:15:23
问题 I have a requirement to change language of App on selection of radio buttons. App already has localization implemented using Android Resources. I have tried below solutions in different combinations from Activity as well as normal class, but nothing worked so far: CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(lang); // lang => en-US or nl-BE System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(lang); var locale = new Java.Util.Locale(lang); Java.Util.Locale

Android Annotation processor access resources (assets)

£可爱£侵袭症+ 提交于 2021-01-29 04:04:47
问题 I want to access a resource from my andoid studio project in my annotation processor. I first tried to use the getResource method from filer: FileObject fo = processingEnv.getFiler().getResource(StandardLocation.SOURCE_PATH, "", "src/main/res/layout/activity_main.xml"); , but it always throwed a exception that just returned "src/main/res/layout/activity_main.xml" as a message. Next think i have tried was this.getClass().getResource("src/main/res/layout/activity_main.xml") , but this always

Is there a way to have a Resource name inside strings.xml with a space?

99封情书 提交于 2021-01-29 03:02:44
问题 Example: Android complains that ' ' is not a valid resource name character. Am I forced to use say "New_Delhi" and then programatically map this in my program? 回答1: Yes, for the simple reason that Java fields cannot have spaces in their names. A string resource named New_Delhi is referenced in Java as R.string.New_Delhi . A space, in lieu of the underscore, would not be valid Java syntax. 来源: https://stackoverflow.com/questions/36483076/is-there-a-way-to-have-a-resource-name-inside-strings

Errors in color resources

谁说我不能喝 提交于 2021-01-28 10:39:10
问题 I'm getting lint errors attempting to use color resources. According to the documentation, the following should be valid. <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <color name="actionbar_title"></color> </resources> But this gives "Attribute is missing the Android namespace prefix". Amending to <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <color android:name=