android-imageview

Rotate image from center point in imageview

一世执手 提交于 2020-01-04 15:15:36
问题 I want to rotate an image in android. I found this useful post and it works great but it seems rotation in android starts from bottom left corner. I need to rotate my image from center point. Is it possible? Code for the same is helpful. Thanks. 回答1: The problem with @goodm's solution is that imageView might not have been layed out yet which causes imageView.getDrawable().getBounds().width() and .height() to return 0. That's why you're still rotating around 0,0. One way around this is to

ListView shows wrong and duplicates images

喜欢而已 提交于 2020-01-03 16:37:18
问题 I have a ListView and 12 ImageViews in it. Every ImageView has different image which is loading from url. Images are shuffled and sometimes duplicated either I scroll or not. I tried 10 other ways to solve this problem but have not succeeded. This is the code I download and show images: private static class ViewHolder { ImageView imageViewPhoto; Bitmap photo; boolean isDownloading; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder

Android code to rotate an image view on touch or drag event

核能气质少年 提交于 2020-01-03 09:54:50
问题 I need to rotate an image on touch and drag. now i need a degree angle when user press the imageView and moove for rotating, kindly help me for the same. imageView.setRotation(degree); i need value of this degree variable in MotionEvent.ACTION_MOVE block. 回答1: u want use the RotateGestureDetector in your project class as below given.. public class RotateGestureDetector extends TwoFingerGestureDetector { /** * Listener which must be implemented which is used by RotateGestureDetector * to

Android code to rotate an image view on touch or drag event

﹥>﹥吖頭↗ 提交于 2020-01-03 09:53:31
问题 I need to rotate an image on touch and drag. now i need a degree angle when user press the imageView and moove for rotating, kindly help me for the same. imageView.setRotation(degree); i need value of this degree variable in MotionEvent.ACTION_MOVE block. 回答1: u want use the RotateGestureDetector in your project class as below given.. public class RotateGestureDetector extends TwoFingerGestureDetector { /** * Listener which must be implemented which is used by RotateGestureDetector * to

Allow user to select background from personalize screen

江枫思渺然 提交于 2020-01-03 04:50:08
问题 In my widget, I want the user to be able to set the background of the main page by selecting a picture from their gallery and then that image would also show up in a imageView on the personalize screen (so they know what the image will look like). So far, I have the imageView set up on the personalize page: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

How to display searchview close icon when expanded in android?

大憨熊 提交于 2020-01-03 03:44:08
问题 I have an imageView. When i click image, i am hidding image and enabling searchview in expanded. But problem is close icon is not visible. How to make close icon visible when searchview in expanded form? Here is my piece of code: public class HomeActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); search = (SearchView) findViewById(R.id.search); searchImage=(ImageView)

Why setImageResource displays nothing?

余生颓废 提交于 2020-01-02 06:11:11
问题 I would like to display an icon in my ListView depending on the database value. I follow this answer to do so. But in result nothing is displayed. Here is what I have in my row.xml : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/movie_subscribed_icon" android:padding="3dip" android:layout_width="wrap_content" android:layout_height=

Saving an image from ImageView into internal storage

别等时光非礼了梦想. 提交于 2020-01-01 19:56:46
问题 I have created an ImageView and I can see the preview of the Camera and load the captured image into the ImageView and I wanted to store the image into a directory in my internal memory. I have referred many posts and tried but I couldn't find my image in my internal memory. This is the code I have used: package com.example.shravan.camera; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.pm.PackageManager; import

ImageView adjustViewBounds not working with Relative Layout

浪尽此生 提交于 2020-01-01 09:23:12
问题 I have an ImageView and have set its layout_height to "100dp" and its layout_width to "wrap_content". The drawable used has bigger actual dimensions that are 130dp (width) X 215dp (height). When the ImageView is placed inside a LinearLayout , if I set adjustViewBounds to true, it gets a width that is measured according to the drawable's aspect ratio and the layout_width. However, when placed inside a RelativeLayout the ImageView gets the same width as the drawable (130dp), no matter the

ImageView adjustViewBounds not working with Relative Layout

拈花ヽ惹草 提交于 2020-01-01 09:22:35
问题 I have an ImageView and have set its layout_height to "100dp" and its layout_width to "wrap_content". The drawable used has bigger actual dimensions that are 130dp (width) X 215dp (height). When the ImageView is placed inside a LinearLayout , if I set adjustViewBounds to true, it gets a width that is measured according to the drawable's aspect ratio and the layout_width. However, when placed inside a RelativeLayout the ImageView gets the same width as the drawable (130dp), no matter the