android - android中不需要的填充

标签 android android-linearlayout padding

我在水平方向的 LinearLayout 中有一个 ImageView 和 TextView 。不知道为什么 textview 左边有一个我无法删除的空格...... 我用填充、重力等进行了测试......

这是我的 xml 并生成图像

有什么想法吗?

谢谢!

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="left|center_vertical"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/dot" />

        <TextView
            android:id="@+id/text_resultado"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-light"
            android:gravity="center"
            android:padding="3dp"
            android:text="TextView"
            android:textColor="@color/negroLetras"
            android:textSize="@dimen/titles" />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-light"
        android:paddingBottom="3dp"
        android:paddingRight="3dp"
        android:paddingTop="3dp"
        android:text="%"
        android:textColor="@color/negroLetras"
        android:textSize="@dimen/titles" />

</LinearLayout>

enter image description here

最佳答案

可能您的可绘制“点”或其他值(例如 dimen 等)有问题。 我认为这是因为我使用了没有此值的代码以及其他示例值和布局是可以的。

关于android - android中不需要的填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19003444/

相关文章:

android - flutter 热重载在我的设备上不起作用

android - 如果 sibling 消失,则查看填充空间

android - 试图避免多个布局级别

Node.js 加密 key 和 iv 以匹配 java SecretKeySpec/IvParameterSpec

Android 将JSONObject 转换为HashMap 并使用SimpleAdapter 在ListView 中显示

android - 从 Android 应用程序存储游戏统计信息

android - 文本未在 TextView 中正确显示

encryption - 如果数据是流式传输或对于 HMAC 来说太大,如何防止 "padding oracle"攻击?

html - Google Chrome Bug,CSS Padding 样式应用于空单元格

java - 将 Realm 对象传递给警报管理器的待处理 Intent