android imageview set image from drawable programmatically
In XML :
android:background="@drawable/imagename
android:src="@drawable/imagename"
In Code :
imageview.setImageResource(R.drawable.imagename);
android imageview set image from drawable programmatically
In XML :
android:background="@drawable/imagename
android:src="@drawable/imagename"
In Code :
imageview.setImageResource(R.drawable.imagename);
android display drawable in imageview
img=(ImageView)findViewById(R.id.imageview1);
Drawable myDrawable = getResources().getDrawable(R.drawable.imageView1);
img.setImageDrawable(myDrawable);
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);
how to create a new imageview in android java
ImageView move = new ImageView(this);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us