imageview

How to create button with image & text

僤鯓⒐⒋嵵緔 提交于 2020-01-02 11:12:10
问题 Friends, I want to display a button in android like mentioned in screenshot. Could anyone guide me through how to achieve this? 回答1: There is the ImageButton which you can use for that. But I'm not sure how to make the Text on the button look like the Text in your screenshot. I would simply create the image with the text and then use it for the ImageButton . 回答2: Use a normal Butto with drawableLeft attribute. See my sample code: <Button android:layout_width="100dip" android:layout_height=

How to create button with image & text

走远了吗. 提交于 2020-01-02 11:11:47
问题 Friends, I want to display a button in android like mentioned in screenshot. Could anyone guide me through how to achieve this? 回答1: There is the ImageButton which you can use for that. But I'm not sure how to make the Text on the button look like the Text in your screenshot. I would simply create the image with the text and then use it for the ImageButton . 回答2: Use a normal Butto with drawableLeft attribute. See my sample code: <Button android:layout_width="100dip" android:layout_height=

ImageView will not load via setImageURI when ran on Samsung Galaxy S4 Only

跟風遠走 提交于 2020-01-02 08:59:09
问题 I've had a specific issue when running some basic code on a Samsung Galaxy S4 (model: GT-I9500). I was implementing a image picker via the camera or gallery, and could not for the life of me figure out why the ImageView was blank when calling - imageView.setImageURI(uri); It wasn't until I ran the exact same code in the emulator (and then a Nexus 5) that I found that this was a Samsung S4 issue. Full sample project can be found on Github & ready to run Code I used was taken from this SO post:

Fitting ImageView Horizontally

耗尽温柔 提交于 2020-01-02 07:01:17
问题 I am developing a sort of ebook application and I am trying to display an image in the following two ways. When the screen is in portrait , I have the image horizontally fitted and vertically centered. When the screen is in landscape , I want the image to fill the screen horizontally with the aspect ratio maintained. Since the images that I am using are longer than they are wide, I have a ScrollView to allow viewing of the entire image. How should I be scaling my ImageView to achieve this? I

Find the position of a bitmap in android imageview when container view scaled centerInside

谁说我不能喝 提交于 2020-01-02 06:06:59
问题 I have an RelativeLayout that contains a custom ImageView, the scaleType="centerInside", I load in a bitmap (usually smaller than the imageView). How can I get the top/left position of where the bitmap was drawn? I need to be able addView's on top a positions relative to the bitmap. RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.scroll_scaled, container, false); ContentImageView image = (ContentImageView) view.findViewById(R.id.base_page); Bitmap bm = mInterfaceActivity

Why imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); and <application android:hardwareAccelerated=“false” have different effect?

自作多情 提交于 2020-01-02 03:10:28
问题 I wonder why if I set <application android:hardwareAccelerated="false" using svg-android i see no image (due to hw acceleration problem?), but if I set imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); I can get it to work. Does View.LAYER_TYPE_SOFTWARE disables the hw acceleration or not? 回答1: The direct answer to your question (Does View.LAYER_TYPE_SOFTWARE disables the hw acceleration or not?) is YES. It actually disable hw acceleration, but only at a view level, i.e. hw accl is

Set Image to a ImageView from URL [duplicate]

余生颓废 提交于 2020-01-01 19:29:10
问题 This question already has answers here : How to load an ImageView by URL in Android? [closed] (23 answers) Closed 5 years ago . I have Imageview and a link to the picture on the Internet. I set this picture to the ImageView like this, public ImageView iv; iv = (ImageView) findViewById(R.id.imageView); String img = "https://www.google.com/images/srpr/logo11w.png"; iv.setImageDrawable(Drawable.createFromPath(img)); What I want to do is download a picture from the internet to my android

Rounded corners on dynamicly set ImageView in widget?

守給你的承諾、 提交于 2020-01-01 19:28:10
问题 I have a widget with a config activity, where the user can select a color for the background of the widget from a color picker. I am using the method below where I have an ImageView and create a Bitmap which I dynamically set on the ImageView. http://konsentia.com/2011/03/dynamically-changing-the-background-color-in-android-widgets/ public static Bitmap getBackground (int bgcolor) { try { Bitmap.Config config = Bitmap.Config.ARGB_8888; // Bitmap.Config.ARGB_8888 Bitmap.Config.ARGB_4444 to be

drag, zoom imageview without matrix android

只谈情不闲聊 提交于 2020-01-01 06:56:11
问题 i need a solution for implement drag and zoom , routate ImageView around screen onTouch event without using matrix. i searched a lot but all answers done it with matrix and because i have multi objects in screen matrix is not suitable for me, i want drag and zoom ImageView object not matrix in the ImageView, after some try i implement a class that drag view fine but in zoom it disturb, thanks if someone can help me and sorry for bad language skills and if i have misspelling. package com

Center ImageView inside another ImageView in Android

Deadly 提交于 2020-01-01 06:39:28
问题 Well I have to fit one ImageView inside another one. It is smaller and has to be exactly at the center. I have both images scaled for different screen resolutions but I can test only on one phone and I am wondering if I set the second image's height and width with dpi to fit my screen resolution will it be perfectly matched on all screens or is there any property in Android aside from setting the height and width that will automatically center one ImageView inside of other ImageView? Edit: It