android-drawable

PhoneGap Android: How to force Application to use icons from asset\www\res instead res\drawable folder?

旧城冷巷雨未停 提交于 2019-11-26 12:45:30
问题 I have created new Android phonegap project using eclipse and put my existing WWW folder of my iphone phonegap project. I have all the icons and screen added for android device inside Android folder as show here.. and also added it to my config.xml For HDPI I have following icon and screen. assets\\www\\res\\icon\\android\\icon-72-hdpi.png assets\\www\\res\\screen\\android\\screen-hdpi-portrait.png When I run the application in Emulator, it keep showing the default PhoneGap icons and splash

Adjust icon size of Floating action button (fab)

老子叫甜甜 提交于 2019-11-26 12:35:56
问题 The new floating action button should be 56dp x 56dp and the icon inside it should be 24dp x 24dp . So the space between icon and button should be 16dp . <ImageButton android:id=\"@+id/fab_add\" android:layout_width=\"56dp\" android:layout_height=\"56dp\" android:layout_gravity=\"bottom|right\" android:layout_marginBottom=\"16dp\" android:layout_marginRight=\"16dp\" android:background=\"@drawable/ripple_oval\" android:elevation=\"8dp\" android:src=\"@drawable/ic_add_black_48dp\" /> ripple

Custom ProgressBar

这一生的挚爱 提交于 2019-11-26 12:29:18
问题 I am trying to create a ProgresBar that looks like the following: So far, I have created an object which extends ProgressBar, and now I am trying to figure out what my next step is. I know that I need to override onDraw() with some logic that will decide how many squares to color in. This is trivial. What I don\'t know how to do is get these squares in the first place. How can I replace the default drawable, so when I add my custom bar in the layout I can see something like my image? 回答1: try

How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn&#39;t create icon: StatusBarIcon

南楼画角 提交于 2019-11-26 11:12:48
I'm seeing the following exception in crash logs: android.app.RemoteServiceException: Bad notification posted from package com.my.package: Couldn't create icon: StatusBarIcon(pkg=com.my.package user=0 id=0x7f02015d level=0 visible=true num=0 ) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1456) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5487) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android

How to reference style attributes from a drawable?

随声附和 提交于 2019-11-26 11:07:32
I want to have 2 selectable themes for my application. In order to do that, I defined some attributes, like this: <attr format="color" name="item_background" /> Then, I created both themes, like this: <style name="ThemeA"> <item name="item_background">#123456</item> </style> <style name="ThemeB"> <item name="item_background">#ABCDEF</item> </style> This method works great, allowing me to create and modify several themes easily. The problem is that it seems that it can be used only in Views, and not in Drawables . For example, referencing a value from a View inside a layout works: <TextView

How to upload an image in parse server using parse api in android

前提是你 提交于 2019-11-26 10:58:45
问题 I want to upload an image in parse cloud server in android. But I am unable to do so. I have tried the following code: Drawable drawable = getResources().getDrawable(R.drawable.profilepic) ; Bitmap bitmap = (Bitmap)(Bitmap)drawable() ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] data = stream.toByteArray(); ParseFile imageFile = new ParseFile(\"image.png\", data); imageFile.saveInBackground(); Please let me know how

Creating & Using 9-patch images in Android

走远了吗. 提交于 2019-11-26 10:30:44
问题 I recently heard about 9-patch images. I know its 9 tiled and is stretchable. I\'d like to know more about it. How can I create a 9-patch image? Is there any tool? Can I create it from AndroidSDK or code? Main Advantages of 9-patch over regular png? (is it stretchable dynamically/ automatically according to screen?) 回答1: Today I discovered nine patch images. The official documentation (linked to in the other answers) is ok I suppose, but it really lacks in examples. This little tutorial has

Create a Bitmap/Drawable from file path

£可爱£侵袭症+ 提交于 2019-11-26 09:31:20
问题 I\'m trying to create a Bitmap or Drawable from existing file path. String path = intent.getStringExtra(\"FilePath\"); BitmapFactory.Options option = new BitmapFactory.Options(); option.inPreferredConfig = Bitmap.Config.ARGB_8888; mImg.setImageBitmap(BitmapFactory.decodeFile(path)); // mImg.setImageBitmap(BitmapFactory.decodeFile(path, option)); // mImg.setImageDrawable(Drawable.createFromPath(path)); mImg.setVisibility(View.VISIBLE); mText.setText(path); But setImageBitmap() ,

Understanding Android&#39;s <layer-list>

拈花ヽ惹草 提交于 2019-11-26 09:24:35
问题 I don\'t understand how the layer-lists work. I read the official documentation with some examples but it does not work for me like expected. I want four squares which should be padded with 1dp, but nothing is like expected. Here is a screenshot scaled by 500%: (The wrong colors do not matter) As you can see the size is completely wrong and the paddings are missing. I tried to set real values like width/height and right/left/top/buttom to be sure that android get the point what I want. Here

Mipmap drawables for icons

試著忘記壹切 提交于 2019-11-26 09:15:03
Since Android 4.3 (Jelly Bean) we can now make use of the res/mipmap folders to store "mipmap" images. For example, Chrome for Android stores its icons in these folders instead of the more normal res/drawable folders. How are these mipmap images different from the other familiar drawable images? I see that in my manifest, we use the @mipmap/ qualifier, instead of @drawable/ , which makes sense given the resource folder name: <activity android:name=".MipmapDemp" android:icon="@mipmap/ic_launcher" /> References: The Android 4.3 APIs document has the following to say: Using a mipmap as the source