android-imageview

Android: Using alignBaseline for an image following text

怎甘沉沦 提交于 2020-01-01 04:19:08
问题 Below is a TextView followed by an ImageView contained in RelativeLayout. I'm trying to get the bottom of the image to align with the baseline of the text. When I use alignBaseline for the image,reference the TextView, it is the top of the image that aligns with the baseline of the text instead of the bottom. How can I fix this? <TextView android:id="@+id/month" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:text="feb"

Android Autoscroll imageview

∥☆過路亽.° 提交于 2020-01-01 01:13:16
问题 In my activity I have just an ImageView. In it, the src is a picture that is a lot bigger than the screen. I want the picture to scroll slooooowly from left to right until it reaches the right margin of the photo, then start scrolling back towards left until left margin reached. Then start all over again. I need it to happen in a separate thread so the phone would not freeze while this happens. How can I achieve this? Is there a widget that does this by default? UPDATED CODE // layout: <?xml

How to replace R.drawable.“someString”

时光怂恿深爱的人放手 提交于 2019-12-31 10:30:10
问题 I have some Images in my project. The name of the image is stored in a String and I would like to setImageResource(R.drawable."....."); with the string of the image name but the problem is that this is not working. How can I do this? 回答1: this is not a right syntax, and you must getting compiler time error, before altering image resource you must know that, all resources provided an id, these ids are stored into R.java file. Ids are stored into integer format, and in your application you can

Reusing the bitmap variable after recycle

半城伤御伤魂 提交于 2019-12-31 07:29:20
问题 I have recycled the bitmap variable and when I again tried to use the same variable I have some strange errors with reference to recycle. Any solution to this issue ? java code: image1.recycle(); image1=null; LogCat: 05-29 11:35:42.139: E/AndroidRuntime(695): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@2bbad018 05-29 11:35:42.139: E/AndroidRuntime(695): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1038) 05-29 11:35:42.139: E

Why does the value of X does not go all the way to the edge of the layout

十年热恋 提交于 2019-12-31 05:29:50
问题 palette2 drawable which is used as a background: esquare drawable (resized using @dimen and used as a thumb): XML: <LinearLayout android:id="@+id/llColorSpect" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_alignParentBottom="true" > <RelativeLayout android:id="@+id/rlColorSpect" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/palette2" > <ImageView android:id="@+id

Android how to create the stack kind of image backgrounds

寵の児 提交于 2019-12-30 10:28:11
问题 I am developing an App where i need to create Albums and display them in a GridView. Now i am just displaying them without any background but i need a background for the Album cover so that it looks like a pile of photos. Background something like this: I tried out this but not it's working: first i created a single background like this: <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#000000" />

Android Picasso ImageView - Out of Memory Exception MemoryLeak

落爺英雄遲暮 提交于 2019-12-30 07:15:10
问题 I am new to Android development. I'm trying to download images via HTTP and storing them inside of ImageViews or Drawables. In this example, I am using ImageViews. Initially, I used an AsyncTask to download these images (roughly ~500KB each), however I decided to use Picasso since I've read it is more reliable. In the code below, I have 20 ImageViews. Each of the image url's is an image that is roughly 400KB. However, after loading all of them, I've noticed my getUsedMem() is greater than

How can I save an image from a url?

左心房为你撑大大i 提交于 2019-12-29 07:12:15
问题 I'm setting an ImageView using setImageBitmap with an external image url. I would like to save the image so it can be used later on even if there is no internet connection. Where and how can I save it? 回答1: You have to save it in SD card or in your package data, because on runtime you only have access to these. To do that this is a good example URL url = new URL ("file://some/path/anImage.png"); InputStream input = url.openStream(); try { //The sdcard directory e.g. '/sdcard' can be used

Android: Using selector to set background color for image view

≡放荡痞女 提交于 2019-12-29 05:55:40
问题 I am trying to set the background color of an image view. <ImageView android:id="@+id/my_image" android:src="@drawable/my_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:clickable="true" android:layout_alignParentLeft="true" android:background="@drawable/selector_image_view" /> I am using the following selector. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item

When click a button rotate image clockwise in android

我与影子孤独终老i 提交于 2019-12-28 22:29:26
问题 I have a requirement where I have an ImageView and a button. http://i1289.photobucket.com/albums/b509/salikclub/Rotate-Last-Start_zps0d2fced8.png I want to rotate the image when I click the button. I need the image with full screen. but when I click the button image will be rotate, but not shown in the full screen. Please see the below link. http://i1289.photobucket.com/albums/b509/salikclub/Rotate-Last1_zps2ccb1326.png After that also when I clicked the button image will rotate. but