imageview

Setting an ImageView to the background Android

久未见 提交于 2019-12-10 22:19:00
问题 I have found many similar questions and answers, but I was unsuccessful with those fixes. I want to set an ImageView to the background so that everything else I am doing is in front of it. (I do not want to use the xml background option because I will be changing my background within the activity and I cannot figure out how to prevent it from stretching.) Thanks! bg = (ImageView) findViewById(R.id.bg); bg.setImageResource(R.drawable.marbles); <ImageView android:id="@+id/bg" android:layout

Black background in circular image view in Lollipop

给你一囗甜甜゛ 提交于 2019-12-10 21:43:58
问题 I have used Circular Image View to implement profile image in circular shape with some colored border. The code works perfect on pre-lollipop devices. But, the same code on Lollipop device shows a Black Background behind the rounded image view. Tried many guesses but unable to fix the bug! Please help. Below is the code :- public class CircularImageView extends ImageView { private int borderWidth = 4; private int viewWidth; private int viewHeight; private Bitmap image; private Paint paint;

Aligning a TextView and ImageView inside a LinearLayout

瘦欲@ 提交于 2019-12-10 20:47:21
问题 I have a ListView with custom adapter and a layout for items in this List. The layout for the items is just a TextView with an ImageView. The image should be aligned to the right side of the screen. However, the image's position is shifting a bit, depending on the length of the text in the TextView. This is what it looks like: This is my XML code: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"

Align Imageview in LinearLayout by code

我只是一个虾纸丫 提交于 2019-12-10 20:39:47
问题 the question is simple, i am creating a imageview dynamically using code. ImageView btnSend = new ImageView (this); and add it to a LinearLayout, the problem is that I want to leave right-aligned how to do that? Thanks in advance 回答1: Try using LayoutParams: LinearLayout rootLayout = (LinearLayout)findViewById(R.id.root_layout); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.gravity = Gravity.RIGHT; ImageView

android, imageview stretch

我们两清 提交于 2019-12-10 20:35:21
问题 I'm trying to get my imageview with a drawable png to fill the display (I don't care about ratios). However, fill_parent doesn't work, and as far as I know there are no background to be set to a RelativeLayout? Regards RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:onClick="toggleAdvice" ImageView android:id="@+id/advice_view"

How to reset an image to the original position

帅比萌擦擦* 提交于 2019-12-10 19:32:54
问题 I am using the TouchImageView class available at https://github.com/MikeOrtiz/TouchImageView I use this class to put a zoom-in and zoom-out to my image the problem is the next one, When i change the image of the TouchImageView it still have the zoom and the position of the last image and what i want is just reset it to the initial position without any zoom is that possible? this is the class package com.example.touch; import android.content.Context; import android.graphics.Matrix; import

CircularImageView and API 16: NullPointerException error

孤街醉人 提交于 2019-12-10 17:45:20
问题 I was testing my app on different APIs and it seems to work on API 17 till 23 but I found in API 16, I cannot load my customview. I just want to display a photo in a circle and I have obtained the code for the customview from this thread: How to create a circular ImageView in Android? My code is pasted here: public class CircularImageView extends ImageView { public CircularImageView(Context context) { super(context); } public CircularImageView(Context context, AttributeSet attrs) { super

Target must not be null using Picasso Library

狂风中的少年 提交于 2019-12-10 16:37:15
问题 I implemented a listView using the Picasso Library 2.4.0 and I'm facing an issue. What happens: I launch the app using Android Studio, then I go to the specific fragment on which I implemented the listView , everything looks ok ( all images are being loaded, same for the TextView ) BUT if I try to scroll down the app crashes. This is what it tells me: 2-03 19:45:38.290 31501-31501/com.zenyt E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalArgumentException: Target must not be null. at

Problems changing the position of an ImageView in Android

主宰稳场 提交于 2019-12-10 16:09:14
问题 I cannot seem to change the position of an ImageView in my android application. It happens when I place my code in a specific method as explained below. I am using the IndoorAtlas library in my android project. I downloaded the sample application and got it running on my phone. Works great. This library has an onServiceUpdate method which is used to handle the location updates. My aim is to move an ImageView whenever the location is updated. Pretty simple. Here is the original method as

Android: ImageView scales up source image

扶醉桌前 提交于 2019-12-10 13:06:01
问题 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