Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.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
Android 丑陋的九块补丁,没有正确缩放_Android_Nine Patch - Fatal编程技术网

Android 丑陋的九块补丁,没有正确缩放

Android 丑陋的九块补丁,没有正确缩放,android,nine-patch,Android,Nine Patch,A为我的Android按钮做了九个补丁,但它们的伸缩性很差。奇怪的是,它们只在一个特定的Android项目中丑陋 <Button android:id="@+id/issueShare" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginLeft="5sp"

A为我的Android按钮做了九个补丁,但它们的伸缩性很差。奇怪的是,它们只在一个特定的Android项目中丑陋

<Button
    android:id="@+id/issueShare"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:layout_marginLeft="5sp"
    android:layout_marginRight="5sp"
    android:background="@drawable/button"
    android:text="Delen" />

我不知道是什么原因导致了九个补丁的规模不好。这是在规模差的项目中使用的XML,在规模好的项目中也是如此

<Button
    android:id="@+id/issueShare"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:layout_marginLeft="5sp"
    android:layout_marginRight="5sp"
    android:background="@drawable/button"
    android:text="Delen" />


我认为问题与手机的密度有关,是否只有drawable文件夹中的九条路径?或者在每个可绘制的特定密度文件夹中都有它的版本吗?

我在一个我永远不会去看的地方找到了解决方案。问题是,在我的Android清单中,我没有指定
Android:targetSdkVersion
,只有
minSdkVersion
。设置
android:targetSdkVersion
后,九个补丁缩放得很好。

我建议使用“wrap\u content”作为布局高度,然后根据需要进行填充。布局也会受到它们的父母的影响,所以你能包括它们正在使用的完整布局文件吗?哦,我有,但测试了它如何在固定高度下工作,但没有帮助。不,我没有为每个设计指定图像,但我发现了问题,请参阅我自己的答案。无论如何谢谢你!美好的我很高兴你发现了问题:)劳科德罗:先生,你是我的英雄!谢谢。