Resize Imageview Based On The Parent Height
I have a layout as defined below Copy
Copy paste this code and add some different sized image and extra textviews.
Solution 2:
This needs to be done using code. You need to call those size APIs a few milliseconds after the screen renders. So, if you call it 100 milliseconds after, using postDelayed method of any view that has been rendered, you will get the sizes.
Solution 3:
try like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_centerVertical="true"android:padding_top = "10dp"android:padding_bottom = "10dp"android:padding_left = "10dp"android:orientation="vertical" >
<ImageView
android:id="@+id/movieImageView"
android:layout_width="75dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:paddingBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:src="@drawable/blank_96_1382x" />
Solution 4:
Try this...
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:padding="5dp"
><ImageViewandroid:id="@+id/ivOne"android:src="@drawable/ic_launcher"android:layout_width="90dp"android:layout_height="90dp" // youcancheckbychangingthevalues.android:layout_marginLeft="10dp"android:layout_marginTop="10dp"android:layout_marginBottom="10dp"android:padding="5dp"
/></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"android:layout_gravity="center|center_horizontal"><EditTextandroid:id="@+id/etOne"android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Enter Text:"android:textColorHint="#4584a1"android:layout_margin="10dp"android:textColor="#4584a1"
></EditText><EditTextandroid:id="@+id/etTwo"android:layout_width="match_parent"android:layout_height="wrap_content"android:hint="Enter Text"android:textColorHint="#4584a1"android:layout_margin="10dp"android:textColor="#4584a1"
></EditText></LinearLayout></LinearLayout>
I hope it will help.
Post a Comment for "Resize Imageview Based On The Parent Height"