android-image

ANDROID — How to display text on an image?

不羁的心 提交于 2019-12-09 01:05:24
问题 Ok...so here's the scenario.. Starting from scratch, I want to display THREE stars (i have an image that I want to use), centered. I want to post a different word in each star. Of course, I do not want it hard-coded, but once I can get the layout right, the rest will be easy. Can anyone help please? I would be greatly appreciated. 回答1: If you're wanting to just overlay text on top of an image, just wrap the ImageView in a FrameLayout, and then just define a TextView after the ImageView. It

Android scaling imageview from setImageBitmap

╄→尐↘猪︶ㄣ 提交于 2019-12-08 15:47:03
问题 I have this code: <ImageView android:id="@+id/listitem_logo" android:layout_width="match_parent" android:layout_height="wrap_content" /> and imageview_logo.setImageBitmap(bit); // comes from assets imageview_logo.setAdjustViewBounds(true); imageview_logo.setScaleType(ImageView.ScaleType.FIT_CENTER); imageview_logo.setBackgroundColor(0x00000000); imageview_logo.setPadding(0, 0, 0, 0); imageview_logo.setVisibility(v.VISIBLE); When loading the image this way, no scaling seems to have been done.

Error: android.view.InflateException: Binary XML file line #26: Error inflating class com.android.camera.CropImageView

房东的猫 提交于 2019-12-08 14:20:04
问题 My application using Image croping and running under some of mobile, however it is giving following error specially while running with Samsung mobile version 4.0 or higher. Complete error log as under. Code { public class CropOptionAdapter extends ArrayAdapter private ArrayList<CropOption> mOptions; private LayoutInflater mInflater; public CropOptionAdapter(Context context, ArrayList<CropOption> options) { super(context, R.layout.crop_selector, options); mOptions = options; mInflater =

Android Swipe Images

最后都变了- 提交于 2019-12-08 13:39:52
问题 I'm trying to find a way to swipe images in my android application.I find a example of how to do that with textview,but I can't do the same thing with ImageView.Here is the original code with TextView : HorizontalPager realViewSwitcher = new HorizontalPager(getApplicationContext()); // Add some views to it final int[] backgroundColors = { Color.RED, Color.BLUE, Color.CYAN, Color.GREEN, Color.YELLOW }; for (int i = 0; i < 5; i++) { TextView textView = new TextView(getApplicationContext());

How to upload image to server?

牧云@^-^@ 提交于 2019-12-08 13:25:10
问题 I have searched many sites to know how to upload image to server.I have seen one sample example.But it is not reading imaging from internal memory of phone. I have included MainActivity.java file.Any suggestions please.. MainActivity.java import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.app.ProgressDialog; import

Programmatically created Image folder not shown in the Public folder

徘徊边缘 提交于 2019-12-08 12:59:39
问题 I'm new to Android Development. I have developed a program that capture images via camera and stored in mnt/sdcard/Pictures/MYFOLDER. And also there is another button foe browse images. image save perfectly. But when I browse the taken images by clicking Browse button it only shows these folders: Pictures,Bluetooth,images. When I navigate to Pictures folder MYFOLDER does not exist. here is my Browse button Button buttonLoadImage = (Button) findViewById(R.id.btnBrowseimage); buttonLoadImage

Bitmap size exceeds VM budget in Android

China☆狼群 提交于 2019-12-08 12:10:18
问题 I used the following code in Gallery View and I got the following exception. Can anyone show me where I am wrong? 07-18 12:45:59.774: WARN/System.err(6758): java.lang.OutOfMemoryError: bitmap size exceeds VM budget 07-18 12:45:59.774: WARN/System.err(6758): at android.graphics.Bitmap.nativeCreate(Native Method) 07-18 12:45:59.774: WARN/System.err(6758): at android.graphics.Bitmap.createBitmap(Bitmap.java:468) 07-18 12:45:59.774: WARN/System.err(6758): at android.graphics.Bitmap.createBitmap

TwoWay GridView library doesn't work properly. (Horizontal GridView)

旧街凉风 提交于 2019-12-08 07:21:14
问题 I was trying to achieve the following task: Setting an horizontal GridView of images instead of the normal vertical GridView. I found out that most StackOverflow answers were targetting this library: https://github.com/jess-anders/two-way-gridview I first ran the sample project and it resulted in the following: Here's the xml File of the TwoWayGridView layout: <?xml version="1.0" encoding="utf-8"?> <com.jess.ui.TwoWayGridView xmlns:android="http://schemas.android.com/apk/res/android" xmlns

Different sized images (with the same name) in one drawable folder

懵懂的女人 提交于 2019-12-08 05:45:37
问题 I'm new to android programming and every single somewhat-similar question is from three or so years ago and doesn't really answer my question. Android Studio used to have different drawable folders for different dpi. Now there is only one. So if I have two images with the same name but for different dpi, where do I add them so that during runtime the phone can use the appropriate image? Also, most android phones now are xhdpi or xxhdpi--do I really need to include any images less than that?

Supporting multiple screens on Android

时光毁灭记忆、已成空白 提交于 2019-12-08 02:56:12
问题 Have read the doc which is lengthy and still not clear. Assuming I have an image with size = 120px * 80px, under the default mdpi/160 density, I also need to prepare ldpi = 90 * 60 hdpi = 180 * 120 xhdpi = 240 * 160 Are the calculation above right? Assume I only have a single layout, so what I need is to prepare the images and place them under the corresponding drawable folders, right? Thanks 回答1: Yes, those are the correct sizes. Yes, just put your various versions in the res/drawable-ldpi,