
但是,我现在使用的XML会使它自动适合父类,例如:
码:
<relativeLayout xmlns:tools="http://schemas.androID.com/tools" xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res-auto" androID:ID="@+ID/parentlayout" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:background="#fff"> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello1" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="20dp" androID:layout_marginBottom="5dp"/> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab2" androID:layout_toRightOf="@+ID/tab1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello2" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="50dp" androID:layout_marginBottom="5dp"/> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab3" androID:layout_toRightOf="@+ID/tab2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello3" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="50dp" androID:layout_marginBottom="5dp"/></relativeLayout>
如何更改代码以获取第一张图像中显示的布局?如果它超出了父文本,只需切断textvIEw.
编辑:尝试过linearLayout.它也没用
<linearLayout xmlns:tools="http://schemas.androID.com/tools" xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res-auto" androID:ID="@+ID/parentlayout" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:background="#fff" androID:orIEntation="horizontal"> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello1" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="20dp" androID:layout_marginBottom="5dp"/> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab2" androID:layout_toRightOf="@+ID/tab1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello2" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="50dp" androID:layout_marginBottom="5dp"/> <TextVIEw androID:layout_margintop="30px" androID:ID="@+ID/tab3" androID:layout_toRightOf="@+ID/tab2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="hello3" androID:textcolor="#1089F9" androID:textSize="40sp" androID:layout_marginleft="50dp" androID:layout_marginBottom="5dp"/></linearLayout>解决方法 尝试在3 TextVIEw上使用This属性
androID:maxlines="1"
设置maxlines =“1”后,我得到了这个结果
总结以上是内存溢出为你收集整理的android – 允许TextView在屏幕之外全部内容,希望文章能够帮你解决android – 允许TextView在屏幕之外所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)