android-resources

Plural definition is ignored for zero quantity

与世无争的帅哥 提交于 2019-11-26 23:12:16
问题 I use plurals to compile a quantity string for an Android application. I follow exactly what one can find in the tutorials: res.getQuantityString( R.plurals.number_of_comments, commentsCount, commentsCount); Here is the definition of the plurals: <?xml version="1.0" encoding="utf-8"?> <resources> <plurals name="number_of_comments"> <item quantity="zero">No comments</item> <item quantity="one">One comment</item> <item quantity="other">%d comments</item> </plurals> </resources> Interesting

findViewById() returns null for Views in a Dialog

随声附和 提交于 2019-11-26 22:58:50
The problem is, no matter where or how I call for this layout's components, they always return null. setView(inflater.inflate(R.layout.search_layout, null)) This works fine. It displays the layout inside the Dialog , yet, the children are always returned as null by findViewById(R.id.some_search_layout_children) . I've tried cleaning my project multiple times, tried to implement another class for my Dialog , called findViewById() as a member of my main Activity , inside the initSearch() method, and inside an anonymous implementation of OnClickListener for the Dialog , but all with the same

ERROR No package identifier when getting value for resource number

落爺英雄遲暮 提交于 2019-11-26 22:23:57
问题 Both activities are in the same package Second activity uses second layout file setContentView(R.layout.main2); Errors on this line in the Second_Activity. EditText text1 = (EditText) findViewById(R.id.EditText03); Here is the layout file for the Second_Activity. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout

Are there conventions on how to name resources?

China☆狼群 提交于 2019-11-26 22:19:38
问题 Are there conventions how to name resources in Android? For example, buttons, textViews, menus, etc. 回答1: I don't know whether there are any official recommendations. For ids in my layouts with widgets and containers, I use the convention: <layout>_<widget/container>_<name> I do the same strategy for any dimens, strings, numbers, and colors I use in those layouts. However, I do try generalizing. e.g if all buttons have a common textColor, I won't prefix the name with the layout. The resource

Android Resources$NotFoundException: Resource ID #0x7f030027

别说谁变了你拦得住时间么 提交于 2019-11-26 22:12:47
I was working on my android program and when I tried testing it I suddenly started getting an error that went "android.content.res.Resources$NotFoundException: Resource ID #0x7f030027" The last major change I made was adding in the action bar via the support library but I got that working fine already. Besides that I've added one new class but even if I delete the class and it's associated files the error still pops up. I have tried cleaning the project and restarting Eclipse multiple times to no avail. Here's the stack trace in case anything got lost in translation: 01-21 19:05:53.125: E

Using Locale to force Android to use a specific strings.xml file for a non-supported language

大兔子大兔子 提交于 2019-11-26 21:18:43
问题 ...and if so, how? We make a dedicated Android device for use in an industrial environment. It's basically a tablet, but with only one app running. The user is not expected to access any other features of the device and even the system settings, like WiFi and Time settings are performed through our app instead of through the Android Settings widget. So basically every button and message they see uses our strings.xml file . Currently all of our customers are satisfied to use the default US

Execution failed for task ':app:processDebugResources' even with latest build tools

我的梦境 提交于 2019-11-26 20:36:58
问题 I am getting this error when I try to run my project. I have installed the latest build tools- 23.0.3 but still the error persists. How do I fix this? Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources] Configuration on demand is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE :app

Android: What is android.R.id.content used for?

巧了我就是萌 提交于 2019-11-26 19:30:55
Anybody could explain the meaning of "android.R.id.content" ? How is it being used ? http://developer.android.com does not have any explanation. public static final int content Since: API Level 1 Constant Value: 16908290 (0x01020002) As Philipp Reichart commented : android.R.id.content gives you the root element of a view, without having to know its actual name/type/ID. Check out http://stackoverflow.com/questions/4486034/android-how-to-get-root-view-from-current-activity The android.R.id.content ID value indicates the ViewGroup of the entire content area of an Activity . It can be used with

Lint: How to ignore “<key> is not translated in <language>” errors?

…衆ロ難τιáo~ 提交于 2019-11-26 19:26:11
I can't compile/debug our Android app, because the localization files are not perfect yet. My IDE's validation tool Lint create errors saying: newCardsOrderVals is not translated in ar, bg, ca, cs Compiling/installing/running with Ant works fine, but I would like to use my IDE to ease debugging. Is there a way to turn off this particular check, or ideally make it a warning rather than an error? I understand that before release we will really need to get localisation files right, but for the time being it is not a priority as the screens themselves are being modified very frequently. Android

What Is The Difference Between -anydpi And -nodpi?

匆匆过客 提交于 2019-11-26 18:52:14
问题 If you use the Vector Asset wizard in Android Studio 1.5.0, any vector drawable XML you import using that wizard goes into res/drawable/ . However, the build/ directory, and the resulting APK show that those XML files get moved into a res/drawable-anydpi-v21/ resource directory. The -v21 part makes sense, as VectorDrawable is only supported on API Level 21+. However, -anydpi seems to be undocumented. I would have expected -nodpi , both for the original import destination and for where the