android – Gridlayout中的TextView出现在屏幕外面

android – Gridlayout中的TextView出现在屏幕外面,第1张

概述我正在创建一个 Android应用程序,用于显示我所在城市可用的所有服务的联系方式.我在我的城市导航应用中使用抽屉.但是具有较长文本(例如Adress)的TextView会退出屏幕.所以请帮助我,以便TextView适合在屏幕上. 以下是我的活动代码: <?xml version="1.0" encoding="utf-8"?><GridLayout xmlns:android="http:// 我正在创建一个 Android应用程序,用于显示我所在城市可用的所有服务的联系方式.我在我的城市导航应用中使用抽屉.但是具有较长文本(例如Adress)的TextVIEw会退出屏幕.所以请帮助我,以便TextVIEw适合在屏幕上.
以下是我的活动代码:

<?xml version="1.0" enCoding="utf-8"?><GrIDLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="wrap_content" androID:layout_height="match_parent"><TextVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="name: "    androID:ID="@+ID/textVIEw27"    androID:layout_row="0"    androID:layout_column="0"        androID:textSize="22dp" /><TextVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="IDea gallery"    androID:ID="@+ID/textVIEw28"    androID:layout_row="0"    androID:layout_column="1"    androID:textSize="22dp" /><TextVIEw        androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="Address: "    androID:ID="@+ID/textVIEw29"    androID:layout_row="1"    androID:layout_column="0"    androID:textSize="22dp" /><TextVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="Shop No 5,Akshay Apartment,Kalwa,Thane - 400605,Opposite Pramila Hospital "    androID:ID="@+ID/textVIEw30"    androID:layout_row="1"    androID:layout_column="1"    androID:textSize="22dp" /><TextVIEw        androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="Contact:"    androID:ID="@+ID/textVIEw31"    androID:layout_row="2"    androID:layout_column="0"    androID:textSize="22dp" /><TextVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:textAppearance="?androID:attr/textAppearanceSmall"    androID:text="022 - 385[enter image description here][1]39146"    androID:ID="@+ID/textVIEw32"    androID:layout_row="2"    androID:layout_column="1"    androID:textSize="22dp" /></GrIDLayout>
解决方法@H_403_16@ 将其添加到TextVIEw中

androID:ellipsize="end" androID:maxlines="1"

它的作用是,如果你的文字很长,它会以点的形式显示.例如:Nadim Shaikh将是Nadim SH …

总结

以上是内存溢出为你收集整理的android – Gridlayout中的TextView出现在屏幕外面全部内容,希望文章能够帮你解决android – Gridlayout中的TextView出现在屏幕外面所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1125764.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存