imageview

How to insert ImageView at the end of multiline TextView?

隐身守侯 提交于 2019-11-29 04:14:22
Maybe it's a stupid question, but I cant find a way to inser small image at the end of second line of TextView. Image is always appears to the right of whole textview, not the line end. I want to insert image like this: TextTextTextTextTextTextTextTextTextText TextTextTextText. <ImageView> What I am getting is: TextTextTextTextTextTextTextTextTextText <ImageView> TextTextTextText. I hope there is way to do it. Src: <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height=

How to load an ImageView from a png file?

微笑、不失礼 提交于 2019-11-29 03:38:40
问题 I take a picture with the camera using Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); startActivityForResult( intent, 22 ); When the activity completes, I write the bitmap picture out to a PNG file. java.io.FileOutputStream out = openFileOutput("myfile.png", Context.MODE_PRIVATE); bmp.compress(Bitmap.CompressFormat.PNG, 90, out); That goes OK, and I can see the file is created in my app private data space. I'm having difficulty when I later want to display that

Android App Display Image From URL

强颜欢笑 提交于 2019-11-29 03:16:30
问题 I'm looking for a very basic function. I'm trying to design an app and all I want it to do is load an image from a URL. I've found a few questions and websites, but they all seem to be older and dated, but what I think I'm having issues with is linking the code to activity main.xml for ImageView. Any suggestions or links you have I would greatly appreciate, thank you. 回答1: Here, this is how I display image from url in the image view you have to call this code from thread other than main

Create ImageViews dynamically inside a loop

瘦欲@ 提交于 2019-11-29 02:54:10
问题 I have written this code that loads an image to in ImageView widget: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gallery); i = (ImageView)findViewById(R.id.imageView1); new get_image("https://www.google.com/images/srpr/logo4w.png") { ImageView imageView1 = new ImageView(GalleryActivity.this); ProgressDialog dialog = ProgressDialog.show(GalleryActivity.this, "", "Loading. Please wait...", true); protected void onPreExecute(){

Android set image as wallpaper

為{幸葍}努か 提交于 2019-11-29 02:44:56
Please show me an example code on how to set image as wallpaper using Android WallpaperManager. I have shortened and edited my question. Hopefully you guys could understand my question. I will show some attempts I have made. HomeActivity.class public class HomeActivity extends BaseActivity { String[] imageUrls; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_home); ArrayList<String> url = new ArrayList<String>(); try { URL url_link = new URL("http://mywebsite.net/web/thumb.xml"); DocumentBuilderFactory dbf =

How to use addHeaderView to add a simple ImageView to a ListView

怎甘沉沦 提交于 2019-11-29 02:35:12
问题 My target is simple. I want to add a "Red Rectangle" as a headerview to a ListView . so I create a simple activity public class MainActivity extends Activity { private String[] adapterData = new String[] { "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView lv; lv = (ListView)findViewById(R.id.list); LayoutInflater lf; View

galaxy s4 and maybe all HD phones? out of memory error inflating layout

故事扮演 提交于 2019-11-29 02:13:33
So this app I am working on, works just fine on a really old miserable Android 2.3.3 phone. However when running it on the GS4, the GS4 is throwing out of memory exceptions every time is has to load a resource from the drawables, that is predefined in the xml. <ImageView android:id="@+id/ivLearnMore" android:layout_width="match_parent" android:layout_height="200dp" android:layout_weight="1" android:scaleType="fitCenter" android:src="@drawable/learn_more" /> For example this Imageview will throw an exception when inflating the layout because it already has an image assigned. (256x256) what is

How set imageview scaletype to topCrop

半腔热情 提交于 2019-11-29 01:42:00
I'm coding android and I have a imageview. I want to set scaletype of this to topcrop. I could find centercrop in options, but it's not my request. How do I do? Custom Android ImageView for top-crop scaling of the contained drawable. import android.content.Context; import android.graphics.Matrix; import android.widget.ImageView; /** * ImageView to display top-crop scale of an image view. * * @author Chris Arriola */ public class TopCropImageView extends ImageView { public TopCropImageView(Context context) { super(context); setScaleType(ScaleType.MATRIX); } @Override protected boolean setFrame

How to add a Marker/Pin on an ImageView Android?

99封情书 提交于 2019-11-29 01:34:21
问题 I would like to ask on how to implement or add a marker on an imageView. I rendered an SVG using svglib and used a customImageView so that I can zoom and pan around the image. here is my code on how i used my customImageView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { SVG svg; switch (mNum) { case 1: svg = SVGParser.getSVGFromResource(getResources(), R.raw.t1); break; case 2: svg = SVGParser.getSVGFromResource(getResources(), R

android imageview.setBackgroundResource() doesn't work

纵饮孤独 提交于 2019-11-29 01:31:10
I have an imageview that should be changed on click public class Settings extends Activity implements OnClickListener { private ImageView im1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings); im1 = (ImageView) findViewById( R.id.imageView1 ); im1.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub if (v == im1 ) { Log.d("test", "hey!"); v.setBackgroundResource(R.drawable.img1); } } } when clicked the method runs and prints out "hey!" but the image won't change?