【问题标题】:How to remove the padding of images into horizontal linearlayout?如何将图像的填充删除到水平线性布局中?
【发布时间】:2012-08-26 21:56:49
【问题描述】:

我正在使用水平线性布局的 xml 代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="60dip"
    android:orientation="horizontal"
    android:paddingLeft="5dip"
    android:paddingRight="5dip"
    android:layout_alignParentBottom="true"
    android:background="@drawable/back1"
    >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="60dip"
        android:clickable="true"
        android:contentDescription="@string/app_name"
        android:src="@drawable/ca_18"
        android:adjustViewBounds="true"/>
</LinearLayout>

并且 ImageView 有一个填充顶部和底部。如何删除填充?

【问题讨论】:

  • 这可能是因为你的 height 属性不是 wrap_content
  • 我改为 android:layout_height="match_parent" (在 ImageView 中),没有任何变化

标签: android android-linearlayout padding


【解决方案1】:

避免硬编码 layout_height 和 layout_width 属性。这在您的设备上可能看起来不错。但可能看起来很难看。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-05
    • 2015-07-27
    • 2015-07-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-26
    • 1970-01-01
    相关资源
    最近更新 更多