android-drawable

Add ripple effect to my button with button background color?

萝らか妹 提交于 2019-12-27 16:31:14
问题 I created a button and I want to add ripple effect to that button! I created a button bg XML file: (bg_btn.xml) <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFFFF" android:endColor="#00FF00" android:angle="270" /> <corners android:radius="3dp" /> <stroke android:width="5px" android:color="#000000" /> </shape> And this is my ripple effect file: (ripple_bg.xml) <ripple xmlns:android="http://schemas.android.com/apk

Programmatically set left drawable in a TextView

末鹿安然 提交于 2019-12-27 12:44:11
问题 I have a textView in xml here. <TextView android:id="@+id/bookTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:drawableLeft="@drawable/checkmark" android:gravity="center_vertical" android:textStyle="bold" android:textSize="24dip" android:maxLines="1" android:ellipsize="end"/> As you can see I set the DrawableLeft in xml. I would like to change the drawable in code. Is there anyway to go about doing this? Or setting the

Programmatically set left drawable in a TextView

≡放荡痞女 提交于 2019-12-27 12:39:36
问题 I have a textView in xml here. <TextView android:id="@+id/bookTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:drawableLeft="@drawable/checkmark" android:gravity="center_vertical" android:textStyle="bold" android:textSize="24dip" android:maxLines="1" android:ellipsize="end"/> As you can see I set the DrawableLeft in xml. I would like to change the drawable in code. Is there anyway to go about doing this? Or setting the

Standard Android menu icons, for example refresh [closed]

放肆的年华 提交于 2019-12-27 12:08:11
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . The Android SDK offers the standard menu icons via android.R.drawable.X . However, some standard icons, such as ic_menu_refresh (the refresh icon), are missing from android.R . Is there any way to get the original icons, maybe by extracting them from the applications? I already checked the Android source, but it

image animation in android

自古美人都是妖i 提交于 2019-12-25 17:44:42
问题 I have to repeat the image sequence I am using with Thread and AnimationDrawable but it is not working continuously. I don't want to stop this animation until next activity is started through button click event. Here is my java code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);{ final ImageView splashImage=(ImageView)findViewById(R.id.heartFunction); splashImage.setBackgroundResource(R.drawable.slide_right); splashAnimation = (AnimationDrawable)

How to get the Drawable name from imageview in android and get it's String name for comparing

爱⌒轻易说出口 提交于 2019-12-25 10:17:17
问题 I have two drawable apple and a how to get the drawable name in my code and compare that they starts with same alphabet Community edited question Questioner is actually seeking for 2 problems- at first he wants to get the drawable id from the imageview id. (thw drawable which is showing in the imageview) then he wants to get the drawable name from that obtained drawable id in step-1. 回答1: Updated answer For step-1 There is no direct way. You need to save the drawable id in the imageview's Tag

Resize image on QVGA screens

烂漫一生 提交于 2019-12-25 07:19:34
问题 I have an app with a login screen. On that screen, I have de company logo. First I made one layout folder and one drawable folder. I tested and all worked ok. Then I have added the 4 layout folders (normal, large, small and xlarge) and the 4 drawable folders (hdpi, ldpi, mdpi, xhdpi). I just copied my logo.png and my main_layout.xml to each folder (thats wrong, but was just for test). Off course, when I test the app on the each differents screen size emulators, It shows the logo image in

Programmatically setting Button Background Drawable Color

隐身守侯 提交于 2019-12-25 06:59:04
问题 I have a drawable created beforehand which is a shape of rectangle but is fully transparent. Now I would like to assign this drawable to the Button in code but also set the Color of this drawable from transparent to some specific color like Orange etc. I have already tried setting the same using some other posts like - Drawable mDrawable = ContextCompat.getDrawable(this, R.drawable.square_transparent); mDrawable.setColorFilter( new PorterDuffColorFilter( Color.Orange, Mode.SRC_IN) ); but it

Android: FileNotFoundException on an image in drawable

北战南征 提交于 2019-12-25 06:37:55
问题 I'm trying to use this code that I've seen on multiple posts throughout stackoverflow public static Bitmap loadBitmap(Context context, String filename) throws IOException { AssetManager assets = context.getResources().getAssets(); InputStream buf = new BufferedInputStream((assets.open("drawable/" + filename))); Bitmap bitmap = BitmapFactory.decodeStream(buf); return bitmap; } but I'm getting a "FileNotFoundException: drawable/filename". I definitely have a file with the name I'm trying to

Pass image from activity to custom view edit

不羁岁月 提交于 2019-12-25 06:23:41
问题 I had create an Activity class and CustomView class. The Activity class able retrieve image from local storage(gallery) and show as ImageView. The CustomView class is build with basic drawing feature such as doodle, erase, save. The question is: After I get the image from gallery, I need to pass the image from Activity class to CustomView class for edit. How should I do that ? Here is my CustomView class (I had remove the unnecessary code, only show the method name): class DrawView extends