java - android studio的不规则输出
问题描述
我正在为我的朋友开发一个安卓应用程序。我想做一个很好找的清单。它在终端上运行良好,但在应用程序上却不行。
我怎样才能像在终端一样呢?
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"/>
解决方案
您需要使用等宽字体。只要您的设备使用的是相对现代的 Android 版本(API 17、iirc),您就可以直接在您的<TextView>
标签上进行设置:
android:fontFamily="monospace"
推荐阅读
- c - 为什么 groupbox 是 Win32 API 中的按钮?(BS_GROUPBOX)
- java - 使用 Java 在 Azure 事件网格中创建事件处理程序(订阅者)
- windows - 如何在管理员模式下使用要执行的命令运行脚本
- angular - Strapi Microsoft 身份验证在 Angular 应用程序中存在重定向 URI 问题
- mysql - 获取当前周的记录,不包括当前周的未来日期
- java - 在 Webfilter 中更改 Rememberme-Cookie
- r - 将相关矩阵转换为R中的协方差矩阵?
- special-characters - 使用 Preg_Match 提取特殊字符之间的两个值
- css - React Datepicker - 内联样式不起作用
- javascript - 如何在 HTML 中打印 javascript 值?