Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ImageSpan在文本行之间留出了额外的空间_Java_Android_Spannablestring_Imagespan - Fatal编程技术网

Java ImageSpan在文本行之间留出了额外的空间

Java ImageSpan在文本行之间留出了额外的空间,java,android,spannablestring,imagespan,Java,Android,Spannablestring,Imagespan,在尝试将ImageSpan放在textview前面时,我在平板电脑(如Nexus 7)上的行之间获得了额外的空间 但在Nexus5x上没关系 xml <TextView android:id="@+id/text_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true"

在尝试将
ImageSpan
放在
textview
前面时,我在平板电脑(如Nexus 7)上的行之间获得了额外的空间

但在Nexus5x上没关系

xml

<TextView
    android:id="@+id/text_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_marginEnd="5dp"
    android:layout_marginStart="-20dp"
    android:layout_toEndOf="@+id/image_container"
    android:layout_toStartOf="@id/progress_title"
    android:ellipsize="end"
    android:lines="3"
    android:maxLines="3"
    android:textAppearance="@style/WorkItemTitleText"
    tools:text="@string/lorem_ispum_short"/>


如何解决此问题?非常感谢您的帮助。

请尝试使用一个库来设置所有设备的相同值。管理所有设备没有问题

将以下依赖项添加到应用程序级渐变文件中

implementation 'com.intuit.sdp:sdp-android:1.0.4'
然后在所有控件中以这种方式给出值后

     android:layout_marginStart="@dimen/_75sdp"
    android:layout_marginTop="@dimen/_75sdp"
    android:padding="@dimen/_15sdp"
     android:layout_marginStart="@dimen/_75sdp"
    android:layout_marginTop="@dimen/_75sdp"
    android:padding="@dimen/_15sdp"