imageview

Moving an image through a linearlayout

你说的曾经没有我的故事 提交于 2020-01-11 12:03:09
问题 I'm developing an Android 2.2 application. I want to move an image from left side of the screen to the right side of the screen. How can I do that? I've read that I have to add this image to a ListView or to a GridView to setup this animation. UPDATE I've created the following files: anim/translate_right <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_decelerate_interpolator"> <translate

Make ImageView visible for set amount of time

两盒软妹~` 提交于 2020-01-11 10:37:30
问题 I have an onClick method set in the xml layout file that triggers the vibration of the phone for 100ms at this point I have the ImageView Visibility set to visible so it can be seen. I want the ImageView to be set back to gone again when the vibration has stopped. How do I go about this? 回答1: You can start this method at the same time: public void timerDelayRemoveView(float time, final ImageView v) { Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { v

app:srcCompat - Vector drawable shows up in design preview, but doesn't show up in app

心不动则不痛 提交于 2020-01-11 09:10:12
问题 drawable/information.xml <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path android:fillColor="#FF000000" android:pathData="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0,0 0,2 12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2Z"/> </vector> LayoutofCardView.xml <ImageView android:layout_width="24dp" android:background="#f00" android:layout_height="24dp" android:id="@

How to dynamically change ImageView Height

℡╲_俬逩灬. 提交于 2020-01-11 05:29:08
问题 I have a simple linear layout used for ListView's cell, and it has an imageview. The image will be downloaded from internet, so the size can be different sizes. However, I want to set the width of imageview to be fill_parent, which is fixed, and dynamically change the image height at runtime. Rules to set the image height: if the image's h/w ratio is more than 1, make the ImageView square, means match the height to the width. if the image's h/w ratio is less than 1, size it proportionally.

How to rotate image in imageview on button click each time?

自闭症网瘾萝莉.ら 提交于 2020-01-11 04:41:07
问题 This is java code.I am getting image from image gallery.I have one Button and one ImageView. It is rotating only one time.When I again click button it is not rotating image. public class EditActivity extends ActionBarActivity { private Button rotate; private ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit); rotate=(Button)findViewById(R.id.btn_rotate1); imageView = (ImageView)

Loading an image in ImageView through code

为君一笑 提交于 2020-01-10 05:29:21
问题 I have built my application using scenebuilder for javafx. I have a form where a person has to upload an image. I used this code public void photoChooser(ActionEvent evt) { System.out.println("photoChooser method is called"); try{ FileChooser fileChooser= new FileChooser(); fileChooser.setTitle("Choose a file"); File file = fileChooser.showOpenDialog(stagehere); if(file != null){ System.out.println(file); String img = file.toString(); //Image image = new ImageIcon(img); try{ // image= new

How can i use RotateAnimation to rotate a circle?

柔情痞子 提交于 2020-01-09 07:06:07
问题 I want my circle image (ImageView) to rotate as the user touch and drag it. If the user drags it to the right, it should spin right and vice versa. Like when you spin a DJ disc, if you know what i mean. I've played around a bit with OnTouchListener and RotateAnimation but i'm getting nowhere. Any ideas? 回答1: Let's assume you have ImageView mCircle which you want to rotate. You have to use RotateAnimation to rotate it. In OnTouch method determine the angle where user's finger is. For example,

What is the best way to display millions of images in Java?

十年热恋 提交于 2020-01-09 04:22:33
问题 You see that ? Each brick of each house is an image of 16x16 pixels. What you can see here a version based on simple JavaFX, with some Imageview moved on X and Y to give the effect of "construction". I just adapt this to Swing using paintComponent . The problem: - With JavaFX: my computer has trouble. What you see on the picture took 2 seconds to load and it is then moving very slow and jerky. - With Swing : I do not know how to adapt each block according to brightness, shadows, etc.. So it

How to get the width and height of an Image View in android?

北城余情 提交于 2020-01-08 16:35:11
问题 In my code I have an Image View in my XML layout and I keep changing the source image for this in my code. Now I want to know the width and height of the generated image each time. I tried using getWidth() , getHeight(), getMeasuredWidth(), and getMeasuredHeight() , but they all return 0. How can I get this? 回答1: Where you calling getWidth() and getHeight() on ImageView? If you calling from onCreate() in activity, it won't work. You need to wait for activity window to attached and then call

Getting real time coordinates of ImageView while it is in Translate Animation on android

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 05:06:08
问题 I have an ImageView, set to Translate animation. I want real time coordinates of the ImageView when it is moving. My code here: ImageView myimage = (ImageView)findViewById(R.id.myimage); Animation animation = new TranslateAnimation(100, 200, 300, 400); animation.setDuration(1000); myimage.startAnimation(animation); animation.setRepeatCount(Animation.INFINITE); int x = myimage.getLeft(); int y = myimage.getTop(); Variables x and y don't updatee real time and only give original static