imageview

Is it possible to have a Button with a background image with text on top?

梦想与她 提交于 2019-12-24 18:37:18
问题 I need button that has a replicated background pattern and normal button text on top - how to specify this in layout XML? 回答1: Override android:background on the Button in question. Or, for reuse you could declare your own style, overriding android:background from the base button style: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyButtonStyle" parent="Widget.Button"> <item name="android:background">@drawable/fancy_button</item> </style> </resources> In either case, your

Glide circular image gets cropped

家住魔仙堡 提交于 2019-12-24 17:28:31
问题 I'm trying to make a circular imageview using glide... I followed this tutorial How to round an image with Glide library? but my image always get the top and bottom cropped i tried to change imageview dimensions but nothing changes, always cropped and same ratio what am i doing wrong Glide.with(this).load(MasterFacade.getFacade().getLocalUser().getProfilePicUrl()).apply(RequestOptions.centerCropTransform()).into((ImageView) findViewById(R.id.profileImageView)); and the layout <ImageView

set extended ImageView width and height programatically - android

只谈情不闲聊 提交于 2019-12-24 16:26:03
问题 I have a custom class that extends ImageView that I'm programatically putting on to a RelativeLayout. I want each one of these images to be a specific width and height. I've tried setting the width/height in code with LayoutParams and with setMaxWidth/setMaxHeight...neither seem to be working. Here is the code from the constructor of the class: LayoutParams p = new LayoutParams(50,67); this.setLayoutParams(p); this.setImageResource(WhichImage(wi)); this.setMaxWidth(50); this.setMaxHeight(67);

how to change next page using swipeview in android?

六眼飞鱼酱① 提交于 2019-12-24 14:02:05
问题 am new to android.am doing simple aphabate app.in that app am using alphabetes letters.when swipe on the letter how it will move to next letter.please give me suggestions thanks in advance 回答1: I would like to suggest u to tak a look at the following Android Dev blog post about using ViewPager in the Android Compatibility Package to implement the swipe functionality you're looking for: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html The recommended

Crop an Image to the size of an ImageView

断了今生、忘了曾经 提交于 2019-12-24 13:10:23
问题 I have an ImageView which is already resized to be a circle, and it contains an image inside, which is already fitted to fill the circle. The only problem is when I open the image in another part of my app it is not a circle but rather in its original form. This is because I didn't resize the image, but rather the ImageView. So my question is how can I crop the image to be the same as it looks (a circle)? Or, if there's a better solution to this like resizing the image rather than the View I

show imageview in android studio without white background

人盡茶涼 提交于 2019-12-24 12:25:34
问题 I have a transparent image and when I add in my imageview it appears like this [output image 1] but I want to remove the white color of the image .I need only the carin the image to be show and remove the white borders and make the layout background to be shown is there any way I can do it. this is my cardview.xml <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res

Find the overlapping area of two imageviews overlap, and make this area change colour

自古美人都是妖i 提交于 2019-12-24 12:21:35
问题 I'd like to be able to drag one imageview onto another, such that when they overlap, the overlapping area changes colour. To help visualise the problem, these imageviews are circular: when they overlap, it should form a Venn diagram-style image as shown below. I know you can detect whether the intersection has occurred by using: if (self.imageview1.bounds.contains(self.imageview2.bounds)) { ... } But do not really know how to colour the area in between! 回答1: so I figured out a way to do this

Android ListView with images from special hashmap

元气小坏坏 提交于 2019-12-24 11:29:30
问题 I try to handle a hashmap to show a listview with images. I search for an answer like here: How to display Images in ListView android. But it doesn't work... My Code is: for (int i = 0; i < nodes.getLength(); i++) { Element e = (Element)nodes.item(i); Map<String, Object> datum = new HashMap<String, Object>(2); String img_url = getValue(e, "pic"); URL url = null; try { url = new URL(img_url); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Bitmap

How do I tell when an image is clipped?

陌路散爱 提交于 2019-12-24 11:13:07
问题 If I have a LinearLayout containing ImageViews, how could I write code to tell which, if any, is clipped by the edge of the screen? <LinearLayout android:id="@+id/imagecontainer" android:orientation="horizontal" android:layoutHeight="wrap_content" android:layoutWidth="fill_parent"> <ImageView android:id="@+id/image1" .../> <ImageView android:id="@+id/image2" .../> ... <ImageView android:id="@+id/imageN" .../> </LinearLayout> I imagine something like, which would return an index or 0 if nobody

Gridview - click gridview item to show image in imageview

随声附和 提交于 2019-12-24 10:03:06
问题 I follow this toturial Android Lazy Loading images and text in listview from http json data and now i change listview to gridview. My question is I want to click gridview item and it show image in imageview MainActivity public class MainActivity extends Activity { GridView gridView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String strUrl = "http://ta.wptrafficanalyzer.in/demo1/first.php/countries/";