Thursday, 26 February 2015

android layout justification



I have a image view and text views in my layout and it looks like this


enter image description here


How can i fill the empty space with the text? i have used android:layout_toRightOf="@+id/movie_image" to get the text next to the image but it does not fill the empty space when the image is over.


My code



<RelativeLayout
android:id="@+id/upperPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>

<ImageView
android:id="@+id/movie_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:src="@drawable/ic_launcher"
android:scaleType="fitXY"/>


<TextView
android:id="@+id/title_movie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_toRightOf="@+id/movie_image"
android:text="@string/temp_title"
android:textSize="18dp"
android:textStyle="bold" />

<TextView
android:id="@+id/description_movie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="@string/moviedescription"
android:layout_toRightOf="@+id/movie_image"
android:layout_below="@+id/title_movie"
android:textSize="14dp"
/>


</RelativeLayout>

No comments:

Post a Comment