首页 > 解决方案 > android studio的不规则输出

问题描述

我正在为我的朋友开发一个安卓应用程序。我想做一个很好找的清单。它在终端上运行良好,但在应用程序上却不行。

我怎样才能像在终端一样呢?

app查看 终端查看 java代码:

c = c.format("%3s", c);
d = d.format("%3s", d);
e = e.format("%2s", e);
arrayList.add(a+" | "+b+" | "+c+" | "+d+" | "+e+"/"+f);

xml代码

<ListView
    android:id="@+id/genel_liste"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fontFamily="sans-serif"/>

标签: javaandroidandroid-studio

解决方案


您需要使用等宽字体。只要您的设备使用的是相对现代的 Android 版本(API 17、iirc),您就可以直接在您的<TextView>标签上进行设置:

android:fontFamily="monospace"

推荐阅读