android-drawable

Drawable resource files not found for Google Play component

三世轮回 提交于 2019-12-12 00:37:39
问题 I have previously been using Xamarin Studio to code a Google Maps application and have copied the files into a new folder to use in Visual Studio. I am getting many resource errors all in relation to the Google Play component when building the Android application in Visual Studio. Here is one of the errors: No resource found that matches the given name (at 'drawable' with value '@drawable/common_signin_btn_icon_pressed_dark') Here is the XML file: <?xml version="1.0" encoding="utf-8"?>

Drawable.createFromPath(filePath) returning null although the file exist

自作多情 提交于 2019-12-11 21:25:59
问题 I have this code: String filePath = getActivity().getFileStreamPath("into11.png").getAbsolutePath(); if(Drawable.createFromPath(filePath)!=null){ img.setImageDrawable(Drawable.createFromPath(filePath)); } else{ Log.d("nulllllllllllllllllllllllllllllllll","yessssssssssssssssssssssssssss"); } the filepath is getting the right path of the image "data/data/.../intro11.png" but Drawable.createFromPath(filePath) is null so what's the cause of this? 回答1: Use this code: File drawableFile = new File

Animating ActionBar's icon

坚强是说给别人听的谎言 提交于 2019-12-11 17:54:43
问题 I have an ActionBar icon (the main one on the left, not an action item) that I would like to animate. I am setting my ActionBar 's icon in my Activity like this: getSupportActionBar().setIcon(icon) where icon is a Drawable produced by a library that converts a custom XML view into a bitmap. This XML view is a RelativeLayout with a background image and a TextView on top. Today, when I have to update the TextView I simply re-generate the icon and call setIcon again. Instead, I would like to get

Android button shape drawable margin

前提是你 提交于 2019-12-11 16:49:28
问题 Im styling a button using a shape drawable, this causes the button to over expand a little or lose it's margin so it doesnt align well with the other buttons. any idea why: This is my layout code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android

Android: Alternative for context.getDrawable()

非 Y 不嫁゛ 提交于 2019-12-11 16:34:05
问题 I have used context.getDrawable() like this in my project: Drawable greenProgressbar = context.getDrawable(R.drawable.custom_progressbargreen); But Eclipse is giving me an error that it needs a Minimum API level of 21 . This would mean after a quick google search my APP will only be usable on Android 5.0 . Since not all devices are using this version of android I would like to have an alternative for context.getDrawable() . 回答1: The previously accepted method has been deprecated, according to

selector not properly set the image

99封情书 提交于 2019-12-11 15:11:36
问题 i have two images to show it for two different state ,normal and presses. Image for pressed state is slight more bigger in size than in normal state. problem:when i am pressing it changes the image but it wont change the size of the imageview it compresses my image and show me image with same size as image in normal state. I have given wrap_conten for width and height in my xml file. this is my selector class whose refernce i am giving in imageview's src property. <selector xmlns:android=

setBackgroundResource from numeric string causes Fatal Error - Android/Java

送分小仙女□ 提交于 2019-12-11 15:02:34
问题 I'm attempting to set the background of a layout from a numeric filename (it has to be numeric - this cannot be change) string (the image is 1170.png). I attempted to use the following example: Android drawables : Is there any way to somehow link the int IDs to the R drawable IDs? However when I do the result is the following: 06-03 08:36:47.551: E/AndroidRuntime(1765): FATAL EXCEPTION: main 06-03 08:36:47.551: E/AndroidRuntime(1765): Process: com.app.example, PID: 1765 06-03 08:36:47.551: E

After saved image can't see it in Gallery android [duplicate]

若如初见. 提交于 2019-12-11 14:16:28
问题 This question already has answers here : How to save image in android gallery (6 answers) Closed 5 years ago . I am saving Image from res/drawable to Gallery using InputStream and OutputStream . It works fine and save image. But issue is that It does not update Image in Gallery. If I check folder using ES File Explorer then I can see image there. I also checked ddms , It also update image there as soon as write code executes. It works fine if I save Server Image. How to prevent this issue ? I

Get resource identifier (resId) of multiple images from asset or raw folder to an int array

。_饼干妹妹 提交于 2019-12-11 13:12:41
问题 I have 100+ images to load into a listView , and I am trying to store all the resId into an int[] . I can done it from drawable by using the below code Field[] ID_Fields = R.drawable.class.getFields(); resArray = new int[ID_Fields.length]; for(int i = 0; i < ID_Fields.length; i++) { try { resArray[i] = ID_Fields[i].getInt(null); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block

Setting BitmapDrawable tileMode makes the app restart

此生再无相见时 提交于 2019-12-11 13:04:19
问题 While on most of the devices my app is working fine, on some devices (LG G3, Samsung Galaxy S6 so far) I have experienced a strange error, I can not really unfold: Setting tileMode (either via XML or programmatically) to anything ( clamp / repeat / mirror ) on a BitmapDrawable , that is the backround of a layout, makes that background completely black-, and the app restart after ~20 seconds - without any sign of anything going wrong (no messages in LogCat, none of these callbacks of my