Reputation: 62424
How to resize ImageView by java code when I press the Image ?
this my xml
<ImageView
android:id="@+id/MyPic"
android:src="@drawable/clean"
android:layout_gravity="center"
android:gravity="center"
android:layout_height="70dp"
android:layout_width="90dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
/>
and this my java
public class see_me extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.see_me);
MyPic = (ImageView) findViewById(R.id.MyPic);
Upvotes: 0
Views: 232
Reputation: 579
You can resize image like below.
MyPic = (ImageView) findViewById(R.id.MyPic);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(50, 50);
MyPic .setLayoutParams(layoutParams);
Upvotes: 2