Reputation: 23
How can I do the above question? The current image appears way too small. I thought I can fix it by making the height to fill_parent and the width to wrap_content but that didn't work out as the width took the size of the original image and not the scaled version. How can I fix this?
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:src="@drawable/androidImage"
android:scaleType="center"
android:layout_weight="1"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:background="#4CAF50"
android:layout_weight="0">
<TextView
android:id="@+id/textSample"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:layout_alignParentLeft="true"
android:text="Test"
android:textColor="#FFFFFF"
android:textSize="48sp"
android:padding="20dp"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_margin="10dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_mood_white"
android:scaleType="centerInside"
android:background="#100FFFFFF"/>
</RelativeLayout>
</LinearLayout>
Upvotes: 0
Views: 901