简体   繁体   English

是否可以在XML中水平和垂直剪切TextView?

[英]Can TextViews be clipped both horizontally and vertically in XML?

I have a TextView that I want to clip both horizontally and vertically. 我有一个TextView,我想同时水平和垂直剪切。

<TextView android:layout_width="10dip" android:text=""
  android:layout_gravity="clip_vertical" 
  android:layout_gravity="clip_horizontal">
</TextView>

but of course that's invalid XML. 但这当然是无效的XML。

Is there any way of combining these within the XML file? 有什么方法可以在XML文件中将它们组合起来? I can see from the documentation that the switches are bitmap fields. 从文档中可以看到,这些开关是位图字段。 I guess what I want something like: 我想我想要什么:

view.layout_gravity = Gravity.CLIP_HORIZONTAL | Gravity.CLIP_VERTICAL

but without having to dismember the Java. 但不必肢解Java。

尝试

android:layout_gravity="clip_horizontal|clip_vertical"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android中创建水平和垂直滚动的列表视图? - How can I create a listview that scrolls both horizontally and vertically in Android? 你能做一个允许水平和垂直滚动的recyclerview吗 - Can you make a recyclerview that allows scrolling both horizontally and vertically 如何让我的布局水平和垂直滚动? - How can I make my layout scroll both horizontally and vertically? 水平和垂直滚动。 如何在代码视图中显示Java代码并水平和垂直滚动代码? - Scrolling Both horizontally and vertically . how can i show my java code in a code view and scroll my code both horizontally and vertically? 实现一个可以垂直和水平滚动的列表 - Implementing a list that is both vertically & horizontally scrollable 如何使布局水平和垂直滚动? - How to make layout scrollable both horizontally and vertically? 在网格布局中垂直和水平缩放图像 - Scale image both vertically and horizontally within a gridlayout Scrollview在android中水平和垂直滚动表格 - Scrollview to scroll table both horizontally and vertically in android 在 Flutter 中创建可水平和垂直滚动的小部件 - Creating a widget that is both horizontally and vertically scrollable in Flutter 如何在Android中水平和垂直滚动ViewPager? - How to scroll ViewPager both horizontally and vertically in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM