---
title: "Imageview set height by programme"  
description: "Imageview set height by programme"  
author: "Anonymous User"  
published: 2014-10-11  
updated: 2014-10-11  
canonical: https://www.mindstick.com/forum/2366/imageview-set-height-by-programme  
category: "android"  
tags: ["android", "mobile development"]  
reading_time: 1 minute  

---

# Imageview set height by programme

I want to set the height of the [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) programatically in gridview. I used below [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)-

```
imageview.getLayoutParams().height = height;
```

This is [working fine](https://answers.mindstick.com/qa/95550/why-is-the-safari-browser-not-working-fine) in [android](https://www.mindstick.com/articles/13046/10-reasons-why-i-prefer-android-vs-iphone-ios) [version](https://www.mindstick.com/articles/12845/things-to-remember-while-migrating-odoo-to-a-better-version) 4.3 and higher but not working in android version 4.2 and below. I can't find the issue. Any help please.

**[ImageView](https://www.mindstick.com/forum/34664/how-to-set-an-image-on-imageview-in-android) in [xml](https://www.mindstick.com/blog/203/working-with-xml-data-in-sql-server)-**

```
<ImageView android:id="@+id/item_image" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaleType="centerCrop" android:background="@drawable/top_radius" />
```

## Replies

### Reply by Anonymous User

This is a simple way to set dimensions of imageview.\

```
ImageView iv = (ImageView)findViewById(R.id.imageview);int width = 60;int height = 60;LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(width, height);iv.setLayoutParams(parms);
```


---

Original Source: https://www.mindstick.com/forum/2366/imageview-set-height-by-programme

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
