android-imageview

How to show custom DragShadow instead of ListViewFragment row?

谁说我不能喝 提交于 2019-12-11 10:21:24
问题 I have a ListFragment that has a custom adapter so that I could have a text view and an image view on each row. When dragging this row to my canvas (a separate fragment), it shows the whole row as the drag shadow (default behavior). I want to drag only the icon/image to the canvas. My code sample below produces the original drag shadow (whole row from list view) with the desired image drawn behind the cell (a bit stretched because of the bounds setting code). Pretty picture here. According to

How to create a crop layer for a moveable image

谁说我不能喝 提交于 2019-12-11 10:18:52
问题 What I am trying to achieve is the screenshot below: It has the following: Background layer (in this case, red but ideally could support any image such as a pattern) Rotated picture in the middle Rotated black frame around the picture (ideally could support any 9 patch background) Semi-transparent layer around the black frame (currently black with alpha ~ 50%) In the final product the user will be able to move the picture around to select a certain area from it. The frame and semi-transparent

Icon image in circle shape is blurry

半腔热情 提交于 2019-12-11 10:17:18
问题 I have created circle shape drawables that contain png icons. As per the Android Material guidelines the diameter of the circle is 40dp and the icon is 24dp. Initially I did not set any values for left, right, top and bottom as I assumed the internal icon item would stay 24dp. However, it resizes. I then tried using width and height properties to force it to 24dp, which appeared to work in the preview in AS but had no effect on the tablet. Finally I set the values of top, bottom, left and

image loading using url in android

痞子三分冷 提交于 2019-12-11 10:05:42
问题 i was tring to load image using url.a single url is working properly. but i need to add a few more images to this page.i need to add this image s to a list view.pls tell me how can i add a string array to this code. import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache

Setting margins for an imageview dynamically

烈酒焚心 提交于 2019-12-11 09:21:48
问题 may I know how to set margin in imageview dynamically? 回答1: You're probably looking for something like this: http://developer.android.com/reference/android/view/View.html#setLayoutParams(android.view.ViewGroup.LayoutParams) Note this part of the method description though: These supply parameters to the parent of this view specifying how it should be arranged Which means that if you have an ImageView inside of a LinearLayout, you need to supply the method with LinearLayout.LayoutParams, like

How to set image in ImageView?

北城以北 提交于 2019-12-11 07:57:19
问题 I need to put my own image on some imageView . So that's why I created folder named "drawable" in res folder , and copy my Image in this folder , but now I don't know how to set this image to my imageView in XML code. Can anybody help? and sorry for English :) 回答1: In your layout XML file: <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/your_image_name"/> Replace your_image_name with the name of the image file without the extension (e

Same touch listener is called multiple times

隐身守侯 提交于 2019-12-11 07:32:44
问题 I have multiple ImageViews on my screen. Whenever the user moves his finger over one or multiple of them, I want the ones the finger touched, to be removed and create new ImageViews. @Override public boolean onTouch(View view, MotionEvent motionEvent) { ((ViewGroup) view.getParent()).removeView(view); createNewImageViews(); return true; } The problem is, that my app crashes. I think the reason is, that a touchlistener is called again, that already deleted its view and tries to delete it again

Android Resouce by ID / Change image onClick / no change of imageView

无人久伴 提交于 2019-12-11 07:04:12
问题 I have a problem with my imageview not changing after picking an image from an array (xml resource), but falling back into the default value. Content of my MeasurementActivity.java public class MeasurementActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_measurement); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); final ImageView imageViewMeasurement =

ImageView size for phones and tablets

十年热恋 提交于 2019-12-11 06:46:54
问题 I'm making something like a dashboard for my app. And everything fine except situation with ImageView size for diffrent device's screen inch. It looks fine on phones and devices 7" and less But on devices more than 7" it's looking bad In all cases I used same size of ImageView - 50dp and I have generate MDPI, HDPI, XHDPI, XXHDPI images If I will use dimens I will get blured images because MDPI, HDPI, XHDPI, XXHDPI images will be generated only for 50dp, but not for 100dp <?xml version="1.0"

How to detect click on ImageView in ViewPager's PagerAdapter (android)?

心已入冬 提交于 2019-12-11 06:30:38
问题 What is happening: i am trying to detect a onclick event for a view(image) in pager adapter. View i am triggering is imgGodInfoId This is never triggered This seems to work in regular adapter ... so why is it not triggered here AdptAtomicGodGallery.java public class AdptAtomicGodGallery extends PagerAdapter { // Declare Variables Context context; Integer[] godImages; LayoutInflater inflater; String godName; public AdptAtomicGodGallery(Context context, Integer[] _godImages, String _godName) {