android-resources

Retrieve 2Dimensional array from string.xml in android

浪子不回头ぞ 提交于 2020-01-06 10:51:09
问题 i want to keep 100 question and its answer in String .xml , each question having multiple answer , some question having 5 answer and some question having 7 answerlike this .... I want to retrieve those question and answer in my java class <string-array name="array01"> <item name="question">question</item> <item name="answer1">answer1</item> <item name="answer2">answer2</item> <item name="answer3">answer3</item> <item name="answer4">answer4</item> <item name="answer5">answer5</item> </string

Are “strings.xml” string arrays always parsed/deserialized in the same order?

大兔子大兔子 提交于 2020-01-05 07:08:21
问题 Can I count on string arrays within the "strings.xml" resource file to be parsed/deserialized in the same order every time ? If anyone can cite any documentation that clearly spells out this guarantee, I'd appreciate it. Or, at the very least, offer a significant amount of experience with this topic. Also, is this a best practice or am I missing a simpler solution? Note: This will be a small list, so I'm not looking to implement a more complicated database or custom XML solution unless I

Are “strings.xml” string arrays always parsed/deserialized in the same order?

不羁岁月 提交于 2020-01-05 07:08:09
问题 Can I count on string arrays within the "strings.xml" resource file to be parsed/deserialized in the same order every time ? If anyone can cite any documentation that clearly spells out this guarantee, I'd appreciate it. Or, at the very least, offer a significant amount of experience with this topic. Also, is this a best practice or am I missing a simpler solution? Note: This will be a small list, so I'm not looking to implement a more complicated database or custom XML solution unless I

Custom overflow icon is too big (Using android.support.v7 and AppCompat)

徘徊边缘 提交于 2020-01-05 02:48:33
问题 My goal is to have the action bar be a red color, but since my only options from the default android library were white and black, I tried customizing it. I made some custom red icons by using a paint bucket on gimp to just fill in the white icons and re-save it under a different name. I did the same thing with the overflow icon, but for some reason, it's rendering a lot bigger than my other icons, which I don't want. I am using android:minSdkVersion="15" and targetSdkVersion 21 and the

Android IndexOutOfBound Exception for resource getString

一笑奈何 提交于 2020-01-02 03:52:25
问题 Note: This is specific problem with android system, not simply out of bound exception which some suggesting duplicate I have a problem with investigating the cause of the exception. I'm trying to get string resource text(which is HTML): val string = getString(R.string.long_html_text) This HTML is of course valid(works on emulator and other real devices) but not on real device LGE Nexus 5X API 27. The html text has 40113 characters. When I am trying to get this string resource as above I am

android: how to add children from an xml layout into a custom view

坚强是说给别人听的谎言 提交于 2020-01-02 01:18:29
问题 In my xml layouts I have a custom view in which i will put some children like: <com.proj.layouts.components.ScrollLayout android:id="@+id/slBody" android:layout_width="700dp" android:layout_height="400dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="child1"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="child2"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap

How to make custom size of FloatingActionButton

孤者浪人 提交于 2020-01-02 00:54:19
问题 FloatingActionButton by default has two sizes (normal and mini). I need another one (bigger than normal). app:fabSize parameter from xml became private int mSize; variable in FloatingActionButton class. The real size will be determined by this function: final int getSizeDimension() { switch(this.mSize) { case 0: default: return this.getResources().getDimensionPixelSize(dimen.fab_size_normal); case 1: return this.getResources().getDimensionPixelSize(dimen.fab_size_mini); } } Because it

Strange error in R.java, even after cleaning the project: “Underscores can only be used with source level 1.7 or greater”

痞子三分冷 提交于 2020-01-02 00:49:09
问题 So everything was going quite nicely, until just a while ago when R.java decided to have this error after adding an icon ( 5_content_new.png , to be exact). I've tried cleaning the project and restarting eclipse, to no avail. The problem code: public static final class drawable { public static final int 5_content_new=0x7f020000; public static final int ic_launcher=0x7f020001; ... } The red line appears right under 5_ , and the error says: Underscores can only be used with source level 1.7 or

Is it possible to use resource IDs instead of their values for xml preferences in Android?

有些话、适合烂在心里 提交于 2020-01-01 19:18:08
问题 The Goal In my preferences.xml I would like to store the ID of certain string elements (like) e.g. ... <string-array name="preference_values"> <item>@string/nav_start</item> <item>@string/nav_overview</item> <item>@string/nav_someelse</item> </string-array> ... meanwhile in xml/pref_general.xml ... <ListPreference android:key="@string/preference_key" android:entryValues="@array/preference_values" ... /> ... where the different strings will be localized: <string name="nav_start"

Different resources for WVGA800 and WVGA854?

我的未来我决定 提交于 2020-01-01 18:55:35
问题 Got this really stupid problem: Can find the proper name for the android folder for WVGA800 resources. I've created a folder for WVGA854: drawable-normal-long-hdpi It worked totally fine. For WVGA800 I've tried 'drawable-normal-notlong-hdpi' - emulator and handset still gets resources from 'drawable', not even 'drawable-normal-long-hdpi'. Tried using 'drawble-hdpi', 'drawable-notlong-hdpi' - nothing works, it keeps using 'drawable' for resources. How should the folder for WVGA800 be named?