Search Results

Search found 641 results on 26 pages for 'imageview'.

Page 1/26 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Imageview ontop of another imageview

    - by Joelbitar
    I have a listlayout with items in it that looks like this: There is firs an ImageView (the light) and then two textViews. All of this inside a TableLayout. (source here: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/layout/device_switch.xml) I want to have a rotating animation of a loading indicator Ontop of this light when this particular device (light) performs an action or an action is performed on it. How do I put an animation ontop of this light imageview?

    Read the article

  • Inflated ImageView to put in GalleryView isn't the right size

    - by Richard
    I am trying to inflate an ImageView that scales a Drawable that I can display in a GalleryView. My code to inflate the view seems to work fine, except that the attributes of the ImageView are not applied. Specifically, the inflated ImageView does not have the width/height that I set for it via the android:layout params in XML. Can someone show me what I'm doing wrong? I want to set the width/height of the image in dp, so that it is the correct size across multiple screen dpis and support Android 1.5+. As a result I cannot use something like: i.setLayoutParams(new Gallery.LayoutParams(150, 116) My layout definition is: <?xml version="1.0" encoding="utf-8"?> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="150dp" android:layout_height="116dp" android:background="@drawable/gallery_item_background" android:scaleType="fitXY" /> </ImageView> And the snippet I am using to inflate the ImageView is: public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflater(); ImageView i = (ImageView) inflater.inflate(R.layout.gallery_item, null); i.setImageResource(mImageIds.get(position)); i.setScaleType(ImageView.ScaleType.FIT_XY); return i; }

    Read the article

  • Positioning an image inside an ImageView width max height and max width set

    - by andern
    I have an ImageView with max height and max width both set to 100. The figure below is clearly not a square, but you can use your imagination ;) Figure 1: +----------------------------------------------+ ¦ ImageView +--------------+ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Actual image ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ +--------------+ ¦ +----------------------------------------------+ Anyway, If I try to set a BitMap to the ImageView that does not have a ratio of 1:1, the image is positioned like pictured in Figure 1. What I want is for the picture to be placed to the left inside the ImageView like pictured in Figure 2 below. Figure 2: +----------------------------------------------+ ¦--------------+ ¦ ¦ ¦ ¦ ¦ Actual image ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦--------------+ ¦ +----------------------------------------------+ You can see my ImageView in XML below. maxHeight, maxWidth and adjustViewBounds are set during runtime. <ImageView android:id="@+id/someImage" android:layout_alignParentLeft="true" android:layout_below="@+id/textName" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingRight="4dp" /> This is in a RelativeLayout if it makes any difference.

    Read the article

  • Positioning an image inside an ImageView with max height and max width set

    - by andern
    I have an ImageView with max height and max width both set to 100. The figure below is clearly not a square, but you can use your imagination ;) Figure 1: +----------------------------------------------+ ¦ ImageView +--------------+ ¦ ¦ ¦ ¦ ¦ ¦ ¦ Actual image ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ +--------------+ ¦ +----------------------------------------------+ Anyway, If I try to set a BitMap to the ImageView that does not have a ratio of 1:1, the image is positioned like pictured in Figure 1. What I want is for the picture to be placed to the left inside the ImageView like pictured in Figure 2 below. Figure 2: +----------------------------------------------+ ¦--------------+ ¦ ¦ ¦ ¦ ¦ Actual image ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦ ¦--------------+ ¦ +----------------------------------------------+ You can see my ImageView in XML below. maxHeight, maxWidth and adjustViewBounds are set during runtime. <ImageView android:id="@+id/someImage" android:layout_alignParentLeft="true" android:layout_below="@+id/textName" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingRight="4dp" /> This is in a RelativeLayout if it makes any difference.

    Read the article

  • Get the touch position inside the imageview in android

    - by Manikandan
    I have a imageview in my activity and I am able to get the position where the user touch the imageview, through onTouchListener. I placed another image where the user touch over that image. I need to store the touch position(x,y), and use it in another activity, to show the tags. I stored the touch position in the first activity. In the first activity, my imageview at the top of the screen. In the second activity its at the bottom of the screen. If I use the position stored from the first acitvity, it place the tag image at the top, not on the imageview, where I previously clicked in the first activity. Is there anyway to get the position inside the imageview. FirstActivity: cp.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub Log.v("touched x val of cap img >>", event.getX() + ""); Log.v("touched y val of cap img >>", event.getY() + ""); x = (int) event.getX(); y = (int) event.getY(); tag.setVisibility(View.VISIBLE); int[] viewCoords = new int[2]; cp.getLocationOnScreen(viewCoords); int imageX = x - viewCoords[0]; // viewCoods[0] is the X coordinate int imageY = y - viewCoords[1]; // viewCoods[1] is the y coordinate Log.v("Real x >>>",imageX+""); Log.v("Real y >>>",imageY+""); RelativeLayout rl = (RelativeLayout) findViewById(R.id.lay_lin); ImageView iv = new ImageView(Capture_Image.this); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.tag_icon_32); iv.setImageBitmap(bm); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.leftMargin = x; params.topMargin = y; rl.addView(iv, params); Intent intent= new Intent(Capture_Image.this,Tag_Image.class); Bundle b=new Bundle(); b.putInt("xval", imageX); b.putInt("yval", imageY); intent.putExtras(b); startActivity(intent); return false; } }); In TagImage.java I used the following: im = (ImageView) findViewById(R.id.img_cam22); b=getIntent().getExtras(); xx=b.getInt("xval"); yy=b.getInt("yval"); im.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int[] viewCoords = new int[2]; im.getLocationOnScreen(viewCoords); int imageX = xx + viewCoords[0]; // viewCoods[0] is the X coordinate int imageY = yy+ viewCoords[1]; // viewCoods[1] is the y coordinate Log.v("Real x >>>",imageX+""); Log.v("Real y >>>",imageY+""); RelativeLayout rl = (RelativeLayout) findViewById(R.id.lay_lin); ImageView iv = new ImageView(Tag_Image.this); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.tag_icon_32); iv.setImageBitmap(bm); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( 30, 40); params.leftMargin =imageX ; params.topMargin = imageY; rl.addView(iv, params); return true; } });

    Read the article

  • Getting ImageView dimensions before adding the image

    - by twk
    I've got a RelativeLayout that contains these items: LinearLayout ImageView (weight = 1) LinearLayout So, the ImageView should expand and pin the other layouts on the top/bottom of the screen. I'm loading the ImageView using an image stored on a web server. However, I can fetch images of any size from the server, so I'd rather just fetch the exact image size I need. Thus, I need to get the size of the ImageView before I actually fill it in. How can I do this?

    Read the article

  • How do you setLayoutParams() for an ImageView?

    - by DeadTime
    I want to set the LayoutParams for an ImageView but cant seem to find out the proper way to do it. I can only find documentation in the API for the various ViewGroups, but not an ImageView. Yet the ImageView seems to have this functionality. This code doesn't work... myImageView.setLayoutParams(new ImageView.LayoutParams(30,30)); How do I do it?

    Read the article

  • ImageView doesn't rescale Image to selected size

    - by Buni
    I'm using a ImageView with a fixed size for adding an icon to a menu. In my application, I use it a lot of times, but on this ImageView the Layout Params seem to not work. Unlike the others ImageViews, in this case, I'm using a template directly, but I think that's not the problem. <?xml version="1.0" encoding="utf-8"?> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="1dp" android:layout_height="1dp" android:scaleType="fitCenter" android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark" android:contentDescription="ICON" /> Its been used in code as follows. ImageView iview =(ImageView) View.inflate(context, R.layout.icon, null); Theoretically, It should resize automatically the image, however, the images continues with the original size, although the size was 1dp. Where is the problem? Thanks a lot!

    Read the article

  • Android - Correspondence between ImageView coordinates and Bitmap Pixels

    - by Matteo
    In my application I want the user to be able to select some content of an Image contained inside an ImageView. To select the content I subclassed the ImageView class making it implement the OnTouchListener so to draw over it a rectangle with borders decided by the user. Here is an example of the result of the drawing (to have an idea you can think of it as when you click with the mouse on your desktop and drag the mouse): Now I need to determine which pixels of the Bitmap image correspond to the selected part. It's kind of easy to determine which are the points of the ImageView belonging to the rectangle, but I don't know how to get the correspondent pixels, since the ImageView has a different aspect ratio than the original image. I followed the approach described especially here, but also here, but am not fully satisfied because in my opinion the correspondence made is 1 on 1 between pixels and points on the ImageView and does not give me all the correspondent pixels on the original image to the selected area. Calling hoveredRect the rectangle on the ImageView the points inside of it are: class Point { float x, y; @Override public String toString() { return x + ", " + y; } } Vector<Point> pointsInRect = new Vector<Point>(); for( int x = hoveredRect.left; x <= hoveredRect.right; x++ ){ for( int y = hoveredRect.top; y <= hoveredRect.bottom; y++ ){ Point pointInRect = new Point(); pointInRect.x = x; pointInRect.y = y; pointsInRect.add(pointInRect); } } How can I obtain a Vector<Pixels> pixelsInImage containing the correspondent pixels?

    Read the article

  • Android: ImageView scales up source image

    - by legr3c
    I can't seem to get my ImageView to display its source image in its original size. The ImageView looks like this: <ImageView android:id="@+id/Logo" android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" > </ImageView> The source image is 140 pixels wide, yet on the Nexus One's screen, which is 480 pixels wide it uses up half of the width. Using absolute values in px or dp for the width and height changes nothing. The image also looks very antialiased from the upscaling. Why is this happening and how can I prevent it?

    Read the article

  • UITableViewCell imageView.contentMode doesn't work in 3.0

    - by JustinXXVII
    In UITableViewCellStyleDefault, setting the contentMode on the imageView has no result. If I change my build SDK to version 3.1, everything again works. I don't get any warnings or errors when compiling on 3.0 but this code: cell.imageView.contentMode = UIViewContentModeScaleAspectFit; cell.imageView.image = [UIImage imageNamed:[[NSString stringWithFormat:@"%@head.jpg",[gametype objectAtIndex:indexPath.row]]lowercaseString]]; seems to default to the UIViewContentModeCenter, so all of my pictures exceed the cell boundaries and encroach on neighboring cells. Let me reiterate that if I change my target to 3.1 everything works correctly and all pictures are scaled accordingly to fit in the default imageView Is this a known bug?

    Read the article

  • How can I fit an Image into another imageview

    - by user1597833
    I have an imageview with a default image already set from the xml, and I want to change it's image pragmatically so that the new image will scale to the previous image size, both of the images are rounded. I have tried setting the scaleType attribute to different values before setting the new image but it didn't work. This is the xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/up_right_circle_firstiv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:scaleType="fitXY" android:src="@drawable/circle_medium_up" /> This is the activity code: public class MainActivity extends Activity { ImageView middleCircle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); middleCircle = (ImageView) findViewById(R.id.up_right_circle_firstiv); middleCircle.setImageResource(R.drawable.round_pic_one); } } Inside the activity. I have uploaded the screenshots: http://imgur.com/OM79T http://imgur.com/G7y3Q

    Read the article

  • ImageView Force closes my application

    - by BlueFireLady
    Hi there I am really a beginner, and I have been fighting with this problem for 3 days. :( I am able to get an image to show using a grid view and an adapter as in the grid view tutorial, but I wanted to be able to just use ImageView in the xml. public class HelloImage extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView gridview = (ImageView) findViewById(R.id.gridview); gridview.setLayoutParams(new GridView.LayoutParams(85, 85)); gridview.setScaleType(ImageView.ScaleType.CENTER_CROP); gridview.setPadding(8, 8, 8, 8); gridview.setImageResource(R.drawable.hand_tool); } } When I run this it causes the app to force close when loading.

    Read the article

  • Two imageViews vs one imageView and a canvas

    - by user3009842
    I have a bitmap and I want to scale it up to fill an ImageView and overlay the unscaled version of the bitmap on top. Which would be cheaper (in terms of memory and processor usage)? Using two ImageViews, one for each version of the bitmap Using a canvas and drawing on the singular bitmap, using one ImageView I saw this question about ImageView vs Canvas, but it doesn't address memory/processor concerns. My intuition says two ImageViews may use more RAM, while using a canvas would use more processing power while the drawing occurs.

    Read the article

  • Android: how to convert whole ImageView to Bitmap?

    - by yosh
    I have my application that is displaying images with different ratio, resized inside (centerInside) imageView. What I need is to create bitmap from the ImageView including the background (black in this case). So for example I have device screen 320x480, full screen imageView with image resized to 280x480. How could I get 320x480 bitmap from it? On top of this imageview I have some logos or buttons that I don't want to include to bitmap, they're like on top layer. All I need is bitmap with image and black border from some sides.

    Read the article

  • Dice Emulation - ImageView

    - by Michelle Harris
    I am trying to emulate dice using ImageView. When I click the button, nothing seems to happen. I have hard coded this example to replace the image with imageView4 for debugging purposes (I was making sure the random wasn't fail). Can anyone point out what I am doing wrong? I am new to Java, Eclipse and Android so I'm sure I've probably made more than one mistake. Java: import java.util.Random; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.Spinner; import android.widget.Toast; public class Yahtzee4Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Spinner s = (Spinner) findViewById(R.id.spinner); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.score_types, android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s.setAdapter(adapter); } public void onMyButtonClick(View view) { ImageView imageView1 = new ImageView(this); Random rand = new Random(); int rndInt = 4; //rand.nextInt(6) + 1; // n = the number of images, that start at index 1 String imgName = "die" + rndInt; int id = getResources().getIdentifier(imgName, "drawable", getPackageName()); imageView1.setImageResource(id); } } XML for the button: <Button android:id="@+id/button_roll" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/roll" android:onClick="onMyButtonClick" />

    Read the article

  • Can't display image with Imageview on Android

    - by user1029167
    In my \drawable-mdpi folder, I have an image named: test.jpg In my main.xml file, in my LinearLayout section, I have: <ImageView android:id="@+id/test_image" android:src="@drawable/test" android:layout_width="wrap_content" android:layout_height="wrap_content" /> In my src folder, I have only 1 file, HelloAndroidActivity.java with only the following method: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = new ImageView(this); image = (ImageView) findViewById(R.id.test_image); setContentView(image); } This seems to be correct, yet whenever I try to run it, I get The application HelloAndroid (process xxxxx) has stopped unexpectedly. Please try again. The strange part is it previously did display the image, but now it won't and I don't know why. Also, when I comment out the ImageDisplay code, and replace it with TextDisplay code. i.e. TextView tv = new TextView(this); tv.setText("Does this work?"); setContentView(tv); It does display the text. Edit: was asked to post logcat. Link to pastebin.

    Read the article

  • android ImageView scaling to fit another View

    - by Nick
    I have a relative layout that comprises a TextView and an ImageView: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:adjustViewBounds="true"/> </RelativeLayout> It looks as follows: What I want to achieve is: It means that I want my ImageView to scale to fit the TextView by height. Can it be done in xml, without java-coding? If I could write something like android:layout_height="match_that_TextView" it would have solved this issue, but it's impossible I guess.

    Read the article

  • android imageview scrolling to display full high quality image

    - by Javadid
    hi friends... i am working on displaying an image and placing an icon on top of it... clicking the icon will show an enlarged version of the image... though putting the imageview holding the image in a LinearLayout scales the image to the width of the dialog, the problem is that i need to display the image in a dialog but the image is very high resolution and hence is far bigger than the width of the dialog... I need to show the actual image with scrolling for both ways to see the whole image... But whenever i try putting the imageView in a scrollview the top of my imageview is blank... and again though image scrolls downwards the width is scaled to the width of the dialog... Helppppppppp guys....

    Read the article

  • Bitmap in ImageView is cropped off the screen

    - by Computerish
    I'm working on an Android application that needs to download an image and display it inside an image view. The Bitmap is passed to the main java file and added to the image view like this: comic = (ImageView) findViewById(R.id.comic); comic.setImageBitmap(c.getImageBitmap()); This works, except that the left side of the image disappears off the screen. The ImageView is in a ScrollView and the scroll view maintains the correct size. This means that there is black space to the right in the ScrollView and the image is cut off to the left. The XML for the ImageView is this: <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" Any idea why my image is being cut off? Thanks!

    Read the article

  • Showing ImageView next to TextView in a ListView

    - by KDEx
    So I have a listview that is displaying correctly. When the item is "turned on" the text is white and when it's turned off it's grey. That part all functions great. However when I add the ImageView into the mix I get a null pointer exception. I don't understand why. I've tried using bitmaps as well and get the same problem. Here is some code: @Override public void bindView(View view, Context context, Cursor cursor) { TextView rRule = (TextView) view.findViewById(R.id.rule_text); TextView rType = (TextView) view.findViewById(R.id.rule_type); ImageView iChecked = (ImageView) view.findViewById(R.id.checkBox); String ruleName = cursor.getString(1); int ruleType = cursor.getInt(2); String ruleEnabled = cursor.getString(3); switch (ruleType) { /*...some irrelevant code */ } if (ruleEnabled.equals("true")) { rRule.setTypeface(null, Typeface.BOLD); rRule.setTextColor(Color.WHITE); iChecked.setVisibility(View.VISIBLE); //line 271 } else if (ruleEnabled.equals("false")) { rRule.setTypeface(null, Typeface.NORMAL); rRule.setTextColor(Color.GRAY); iChecked.setVisibility(View.GONE); } rRule.setText(ruleName); } Per request the error log: (Sorry was under the impression null pointers dont say anything helpful..I know the error is the imageview) 06-29 10:29:02.777: E/AndroidRuntime(29516): FATAL EXCEPTION: main 06-29 10:29:02.777: E/AndroidRuntime(29516): java.lang.NullPointerException 06-29 10:29:02.777: E/AndroidRuntime(29516): at com.company.app.DefaultRulesList$RulesAdapter.bindView(DefaultRulesList.java:271) 06-29 10:29:02.777: E/AndroidRuntime(29516): at com.company.app.DefaultRulesList$RulesAdapter.newView(DefaultRulesList.java:284) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.CursorAdapter.getView(CursorAdapter.java:246) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.AbsListView.obtainView(AbsListView.java:2033) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.ListView.makeAndAddView(ListView.java:1772) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.ListView.fillDown(ListView.java:672) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.ListView.fillFromTop(ListView.java:732) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.ListView.layoutChildren(ListView.java:1625) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.AbsListView.onLayout(AbsListView.java:1863) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.View.layout(View.java:11278) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewGroup.layout(ViewGroup.java:4224) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.View.layout(View.java:11278) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewGroup.layout(ViewGroup.java:4224) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.FrameLayout.onLayout(FrameLayout.java:431) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.View.layout(View.java:11278) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewGroup.layout(ViewGroup.java:4224) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.LinearLayout.onLayout(LinearLayout.java:1399) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.View.layout(View.java:11278) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewGroup.layout(ViewGroup.java:4224) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.widget.FrameLayout.onLayout(FrameLayout.java:431) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.View.layout(View.java:11278) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewGroup.layout(ViewGroup.java:4224) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.os.Handler.dispatchMessage(Handler.java:99) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.os.Looper.loop(Looper.java:137) 06-29 10:29:02.777: E/AndroidRuntime(29516): at android.app.ActivityThread.main(ActivityThread.java:4424) 06-29 10:29:02.777: E/AndroidRuntime(29516): at java.lang.reflect.Method.invokeNative(Native Method) 06-29 10:29:02.777: E/AndroidRuntime(29516): at java.lang.reflect.Method.invoke(Method.java:511) 06-29 10:29:02.777: E/AndroidRuntime(29516): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-29 10:29:02.777: E/AndroidRuntime(29516): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-29 10:29:02.777: E/AndroidRuntime(29516): at dalvik.system.NativeStart.main(Native Method) Code for iChecked (where the id is called) <ImageView android:id="@+id/checkBox" android:padding="2dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:drawable/checkbox_on_background"/>

    Read the article

  • Android orientation change causes ImageView to dissapear

    - by Jarrod Smith
    Below is my layout for the row template in a SimpleCursorAdapter. The ImageView with id next_arrow disappears on orientation change. If I replace @drawable/arrow with @drawable/icon (copy of the standard sym_def_app_icon) it works fine. I thought it might be somehow related to the icons being of different dimensions, but I resized @drawable/icon to be the exact same dimensions as the arrow and it still worked fine while the arrow didn't. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="90dp" android:background="@drawable/product_list_divider" android:paddingTop="10dp"> <ImageView android:src="@drawable/ninja_20_65" android:id="@+id/category_icon" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginTop="3dp"/> <LinearLayout android:orientation="vertical" android:layout_weight="5" android:layout_width="0dp" android:layout_height="wrap_content"> <TextView android:id="@+id/category_name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Name" style="@style/CategoryHeading" android:layout_marginTop="5dp"/> <TextView android:id="@+id/category_description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Description" style="@style/CategoryDescription"/> </LinearLayout> <ImageView android:src="@drawable/arrow" android:layout_weight="1" android:layout_width="0dp" android:layout_marginRight="10dp" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:id="@+id/next_arrow"/> </LinearLayout>

    Read the article

  • Android animation's first frame is applied too early on ImageView

    - by Robert
    I have the following View setup in one of my Activities: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/photoLayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/photoImageView" android:src="@drawable/backyardPhoto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:scaleType="centerInside" android:padding="45dip" > </ImageView> </LinearLayout> Without an animation set, this displays just fine. However I want to display a very simple animation. So in my Activity's onStart override, I have the following: @Override public void onStart() { super.onStart(); mPhotoImageView = (ImageView) findViewById(R.id.photoImageView); float offset = -25; int top = mPhotoImageView.getTop(); TranslateAnimation anim1 = new TranslateAnimation( Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, top, Animation.ABSOLUTE, offset); anim1.setInterpolator(new AnticipateInterpolator()); anim1.setDuration(1500); anim1.setStartOffset(5000); TranslateAnimation anim2 = new TranslateAnimation( Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, offset, Animation.ABSOLUTE, top); anim2.setInterpolator(new BounceInterpolator()); anim2.setDuration(3500); anim2.setStartOffset(6500); mBouncingAnimation = new AnimationSet(false); mBouncingAnimation.addAnimation(anim1); mBouncingAnimation.addAnimation(anim2); mPhotoImageView.setAnimation(mBouncingAnimation); } The problem is that when the Activity displays for the first time, the initial position of the photo is not in the center of the screen with padding around. It seems like the first frame of the animation is loaded already. Only after the animation is completed, does the photoImageView "snap" back to the intended location. I've looked and looked and could not find how to avoid this problem. I want the photoImageView to start in the center of the screen, and then the animation to happen, and return it to the center of the screen. The animation should happen by itself without interaction from the user.

    Read the article

  • Android fill ImageView from URL

    - by Luke Batley
    Hi i'm trying to add an image to an ImageView from a URL i have tried loading it as a bitmap but nothing is showing. so does anyone know what the best method to do this is or what i'm doing wrong? heres my code @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //Check Preferences which sets UI setContentView(R.layout.singlenews); TextView headerText = (TextView) findViewById(R.id.header_text); headerText.setText("Latest News"); PostTask posttask; posttask = new PostTask(); posttask.execute(); } public void loadNews(){ newsStr = getIntent().getStringExtra("singleNews"); try { JSONObject obj = new JSONObject(newsStr); content = obj.getString("content"); title = obj.getString("title"); fullName = obj.getString("fullname"); created = obj.getString("created"); NewsImageURL = obj.getString("image_primary"); tagline = obj.getString("tagline"); meta = "posted by: " + fullName + " " + created; URL aURL = new URL("NewsImageURL"); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); /* Buffered is always good for a performance plus. */ BufferedInputStream bis = new BufferedInputStream(is); /* Decode url-data to a bitmap. */ bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); /* Apply the Bitmap to the ImageView that will be returned. */ Log.v("lc", "content=" + content); Log.v("lc", "title=" + title); Log.v("lc", "fullname=" + fullName); Log.v("lc", "created=" + created); Log.v("lc", "NewsImage=" + NewsImageURL); Log.v("lc", "Meta=" + meta); Log.v("lc", "tagline=" + tagline); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public class PostTask extends AsyncTask<Void, String, Boolean> { @Override protected Boolean doInBackground(Void... params) { boolean result = false; loadNews(); publishProgress("progress"); return result; } protected void onProgressUpdate(String... progress) { StringBuilder str = new StringBuilder(); for (int i = 1; i < progress.length; i++) { str.append(progress[i] + " "); } } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); Log.v("BGThread", "begin fillin data"); fillData(); } } public void fillData(){ NewsView = LayoutInflater.from(getBaseContext()).inflate(R.layout.newsdetailact, null); TextView Title = (TextView) NewsView.findViewById(R.id.NewsTitle); Title.setText(title); TextView Tagline = (TextView) NewsView.findViewById(R.id.subtitle); Tagline.setText(tagline); TextView MetaData = (TextView) NewsView.findViewById(R.id.meta); MetaData.setText(meta); ImageView NewsImage = (ImageView)NewsView.findViewById(R.id.imageView2); NewsImage.setImageBitmap(bm); TextView MainContent = (TextView) NewsView.findViewById(R.id.maintext); MainContent.setText(content); Log.v("BGThread", "Filled results"); adapter = new MergeAdapter(); adapter.addView(NewsView); setListAdapter(adapter); } }

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >