android-resources

How to return to default style on EditText if I apply a background?

我是研究僧i 提交于 2019-11-28 10:42:21
I just encountered with a problem that I don't know how to solve. It looks silly but I cannot find a way to fix it. I have a form in android with several EditText and when you submit the form it checks those EditText and if they have wrong data I change the EditText to red border (applying a ninepatch image). myEditText.setBackgroundResource(R.drawable.edittext_red); The problem is, I want to restore android's default style when the user change the EditText, but I don't know how to do it. if I do: myEditText.setBackgroundResource(0); It will just remove everything and that's not what I want.

ListView whose id attribute is 'android.R.id.list' Error when I have the ListView id set correctly

落花浮王杯 提交于 2019-11-28 09:06:07
I have a Listview with a custom adapter. I am getting the standard Your content must have a ListView whose id attribute is 'android.R.id.list' error, however, My ListView has an android:id="@android:id/list" value set. It's really doing my head in. Any suggestions? main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Layout"> <ListView android:id="@android:id/list" style="@stlye/ListMenuView"></ListView> </LinearLayout> styles.xml <resources> <style name="Layout" parent="@android:Theme"> <item name="android

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

时光总嘲笑我的痴心妄想 提交于 2019-11-28 09:03:54
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 I get this error: The entity "ent_devicename" was referenced, but not declared. As you can see Android

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

不想你离开。 提交于 2019-11-28 08:27:35
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 string resource added from build.gradle ? Is there an additional parameter we can pass specifying the locale

NullPointerException with string-array in Spinner

点点圈 提交于 2019-11-28 07:40:57
问题 First app and so really new at android (played around about a year ago but nothing came of it), decent at programming. Wanting to make sure app renders on a phone, no functionality atm. Compiles fine, no problems there. Push it to my phone and "Unfortunately, Splitr has stopped". Edit - added to the MainActivity.java, edits have * before and after (not in actual code) but now it flags adapter.setDropDownViewResource(android.R.layout.activity_main); // Apply the adapter to the spinner

Output: error: resource style/TextAppearance.Compat.Notification.Info (aka package_name:style/TextAppearance.Compat.Notification.Info) not found

百般思念 提交于 2019-11-28 07:30:12
问题 After switching to Android Studio 3.2 canary I am getting the following build error. I have seen this post where the guy had a similar issue but no solution was mentioned over their. I want to try new material components and jetpack so is there any possibility where I don't have to switch back. com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed Output: error: resource style/TextAppearance.Compat.Notification.Info (aka com.nsnik.nrs.kotlintest.debug:style

Not Getting Thumb with Genres - Universal Music Player

此生再无相见时 提交于 2019-11-28 07:29:43
问题 I am using UMP example provided by Google, I have not made any change in my code, even I have not tried anything out of the box, I just imported your project into my work-space and checked it on my device, and found that I am not getting Thumb with Genres (Songs by genre) and List of Genres... Whereas I supposed to get Thumb from our JSON, here is what I have tried (but no success) - holder.mImageView.setImageBitmap(description.getIconBitmap()); UPDATE # 1 AS PER SUGGESTED BY @NageshSusarla

How to delete an unused string resource for all configurations in Android Studio?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 07:15:11
I've found an unused string resource, like: <string name="obsoletestring">my name is null!</string> However it is in tens of files, of different languages, in different strings.xml files in values , values-af , values-be , etc folders. I must have missed something not to know any way to do this in Android Studio other than modifying it by hand one by one. tl;dr How to delete an unused string resource for all configurations? chrisonline It is now possible inside Android Studio. After Lint checks you see an option on the right Remove All Unused Resources ! To Delete a single string resource

Store static data in Android - custom resource?

[亡魂溺海] 提交于 2019-11-28 05:02:05
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 will never need to change. Example: Blob | A | B ---------------- Blob 1 | 23 | 42 Blob 2 | 34 | 21 I

Value equals to match_parent or fill_parent in dimens.xml?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 04:50:58
Based on here on XML Attributes section I specify following in my dimens.xml : <dimen name="match_parent">-1dp</dimen> <dimen name="main_left_menu_user_account_width">@dimen/match_parent</dimen> <dimen name="main_left_menu_user_account_height">@dimen/match_parent</dimen> Then I use the both dimensions in my layout: <ImageView android:id="@+id/userAccountImage" android:background="@drawable/user_account" android:layout_width="@dimen/main_left_menu_user_account_width" android:layout_height="@dimen/main_left_menu_user_account_height" /> Then, when I preview to Graphical Layout , it complains: You