安卓布局问题

标签 android xml layout

我不想要 ImageView 和下面的 TextView 之间的(黑色)空间。我究竟做错了什么?感谢您的帮助。

           <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" />

enter image description here

最佳答案

问题是 firStart 使用 Matrix.ScaleToFit 中的 START 常量,它只会选择缩放图像 x 或 y轴

documentation :

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.

解决方法:

您需要使用 fitXY 来从 x 轴和 y 轴缩放图像

关于安卓布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25631371/

相关文章:

c# - 使用 XSD 正确验证 XML 文档

java - 如何将多个元素相互对齐?

android - CardView 中不允许元素 LinearLayout

android - 结合 Canvas 和布局 (Android)

java - 编译应用程序时出现问题 - React Native

android - 在 (Sherlock)DialogFragment 中调用 startActivity(intentServiceIntent) 会导致 ActivityNotFoundException

java - 如何将字体设置为 AlertDialog.Builder 的 setMessage 部分?

java - 在异步线程中解析时出现 fatal error (AsyncTask.doInBackground())

eclipse 中的 java.lang.NoClassDefFoundError : org/aopalliance/intercept/MethodInterceptor with TransactionInterceptor error on maven pom. xml

xml - 如何使用 XPath 获取节点值/innerHTML?