Reputation: 109
I do not want the (black) space between the imageview and the following textview. what am I doing wrong? Thanks for your help.
<RelativeLayout
android:id="@+id/layout_contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/club_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/condition_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@id/club_banner"
android:background="@drawable/overview_cell_header_bg"
android:gravity="center_vertical"
android:paddingLeft="5dp"
android:text="@string/Condition_1"
android:textColor="#ffffff"
android:textSize="13sp"
android:textStyle="normal" />
Upvotes: 1
Views: 40
Reputation: 109
for whom is interested in this i solved the issue by simply adding
android:adjustViewBounds="true"
Upvotes: 0
Reputation: 1210
I tried your code and I get the expected result.
The problem must be in your image I guess. Is that part below the pic actually transparent?
Upvotes: 0
Reputation: 26198
The problem is that firStart
uses the START
constant from the Matrix.ScaleToFit
that will only chooses to scale the image either x or y axis
Compute a scale that will maintain the original src aspect ratio,
but will also ensure that src fits entirely inside dst. At least one
axis (X or Y) will fit exactly.
solution:
You need to use the fitXY
instead to scale the image from x and y axis
Upvotes: 2
Reputation: 1574
Problem:
android:scaleType="fitStart"
This makes the picture fit at the start (top) of the ImageView.
Change the scaleType to something else that matches your needs.
Upvotes: 1