imageview

how can i check if an imageview background is a certain image?

◇◆丶佛笑我妖孽 提交于 2019-12-11 15:48:31
问题 so far im using something like this if (image.getDrawable() != thisContext.getResources().getDrawable(R.raw.anImage) ) { // do something } but it does not work. 回答1: Basically, comparing two drawables is a pain so just convert them to bitmaps and then compare the bitmaps (much easier solution), here's the code: Bitmap bitmap1 = ((BitmapDrawable)fDraw).getBitmap(); Bitmap bitmap2 = ((BitmapDrawable)sDraw).getBitmap(); if(bitmap1 == bitmap2) { do some stuff } 回答2: try converting the Drawables

Rounded scaled ImageView from right side only

▼魔方 西西 提交于 2019-12-11 15:25:12
问题 How can I round an image that is scaled (CenterCrop) from right-top and right-bottom (all right side) only. This is what I am trying to do. I found that class that can do similar (TopRoundedImage, thanks to the author) but for top-left and top-right. I am trying to change it but I guess I am still doing it wrong. Also, I am using Glide to request the image from Internet then I want to round right side only. I have tried to use a background drawable, but it doesn't work (I read it is because

How to set an image in android app with sftp input stream?

匆匆过客 提交于 2019-12-11 15:12:35
问题 I'm using Android Studio to build an application. In this app, I want to get an image in a specific folder from a linux host using Jsch sftp , and set this new picture to an already-existing imageview. But unfortunately the picture doesn't show up. The following are the codes for this so far: MainActivity.java package com.example.picture_controller_2; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app

Why does the Image Picker in my Android app rotate automatically portrait images into landscape?

不羁岁月 提交于 2019-12-11 13:17:59
问题 I'm using this code in my android app to launch camera/gallery to get an Image, and display it into an ImageView. When the user picks an image with landscape orientation everythings works fine, but when the user picks a portrait image, the image is displayed rotated by 90 degrees. I can't understand why..I'm testing my app on a Galaxy S3 with Android 4.3 I've noticed that the problems only occours when the picture is taken by the phone..maybe this is a problem with the S3? This is my code:

SetImageDrawable in a list view

醉酒当歌 提交于 2019-12-11 12:45:13
问题 In my list view, I want to make it so that it will change the drawable in the image view i made, but I get an error every time I run it. ImageView Player; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Player = (ImageView)findViewById(R.id.bob); setListAdapter(new ArrayAdapter<String>(this, R.layout.pointguards, PointGuards)); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() {

Android add border image to ImageView

為{幸葍}努か 提交于 2019-12-11 12:06:07
问题 Is it possible to add a bitmap as border of an ImageView in android dynamically in Java? I have already tried the following: Image view in XML and border as shape the result is wrong I want to add bitmap in border. 回答1: You have got multiple options: Place an other View with the border (also imageview) above your Imageview. Thay might be the simples solution. Just add an other view to your xml and make sure they are overlapping. (Use for example a Relative or FrameLayout as container) Use a

How to use bitmap factory to compress image without reduce the quality taken from camera?

不想你离开。 提交于 2019-12-11 11:54:33
问题 I have 3 images taken from camera and I want to set to 3 ImageView. But it throws OutOfMemory because the image has large size. I've read that bitmap factory can compress the size without reducing the quality. The problem is I don't know how to do that. This is my onClick Button: openCameraButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); file = new File(Environment

Android custom TitleBar - hide text

纵然是瞬间 提交于 2019-12-11 11:49:16
问题 I am using a titlebar with a background image in my android app. values/custom_styles.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="TitlebarBackgroundStyle"> <item name="android:background">@drawable/titlebar</item> </style> <style name="Theme.MyCustomTheme" parent="android:Theme"> <item name="android:windowTitleBackgroundStyle">@style/TitlebarBackgroundStyle</item> <item name="android:windowTitleSize">45dp</item> </style> </resources> layout/titlebar.xml: <?xml version

Monodroid Take a picture with Camera

半世苍凉 提交于 2019-12-11 10:47:01
问题 I have tried it myself with no success, I can do it in java but it is a good bit different in C#. Any help would be great.All I want is to: Launch the camera. Take a photo. View the photo in an image view. 回答1: I know this is a fairly old question, but I'll answer it with my code that I've used. In my experience messing around with this, not all devices are able to use the standard intent and return data back in the OnActivityResult . private void TakePicture() { if (PackageManager

imageview setbackgroundcolor is not working in android

天大地大妈咪最大 提交于 2019-12-11 10:11:55
问题 I asked a question about ui updating in preferencelistfragment in android.(How to change imageview background color in a preference in android?) And it works for android 4.1.2 version. I test it also in 2.3.3, 3.0 and 4.3 android versions and i see that it is not working in these versions. To make question simple, i would like to ask why the code below is not working on these versions: public class SettingsIncomingSearchFragment extends PreferenceListFragment implements SharedPreferences