Answers for "android imageview set image from drawable programmatically"

1

android imageview set image from drawable programmatically

In XML :
    android:background="@drawable/imagename 
    android:src="@drawable/imagename"
    
In Code :
	imageview.setImageResource(R.drawable.imagename);
Posted by: Guest on November-06-2021
0

android display drawable in imageview

img=(ImageView)findViewById(R.id.imageview1);
Drawable myDrawable = getResources().getDrawable(R.drawable.imageView1);
img.setImageDrawable(myDrawable);
Posted by: Guest on April-07-2021
0

how to set drawable name to imageview programmatically

String uri = "@drawable/myresource";  // where myresource (without the extension) is the file

int imageResource = getResources().getIdentifier(uri, null, getPackageName());

imageview= (ImageView)findViewById(R.id.imageView);
Drawable res = getResources().getDrawable(imageResource);
imageView.setImageDrawable(res);
Posted by: Guest on April-21-2020
0

how to create a new imageview in android java

ImageView move = new ImageView(this);
Posted by: Guest on November-24-2020

Code answers related to "android imageview set image from drawable programmatically"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language