android中的(singleLine)单行显示 none start middle
16lz
2021-12-04
http://www.cnblogs.com/firecode/archive/2012/04/23/2466711.html
第一个button 什么都没写。 后面省略号
android:ellipsize="none" none就没有省略号了
android:ellipsize="start" 省略好放到起始的位置
android:ellipsize="middle" 省略号放到中间的位置
android:ellipsize="end" 省略号房子尾部的位置
android:ellipsize="marquee" 跑马灯效果,从左往右的跑马灯效果
View Code ?
<? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:orientation = "vertical" > < Button android:id = "@+id/btn1" android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "0我最帅123456789" android:singleLine = "true" android:background = "#f0f" /> < Button android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "01谢霆锋123456789" android:singleLine = "true" android:ellipsize = "none" /> < Button android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "02陈.冠希123456789" android:singleLine = "true" android:ellipsize = "start" /> < Button android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "03 王力宏123456789" android:singleLine = "true" android:ellipsize = "middle" /> < Button android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "04 任贤齐123456789" android:singleLine = "true" android:ellipsize = "end" /> < Button android:id = "@+id/btn" android:layout_width = "100px" android:layout_height = "wrap_content" android:text = "05 古天乐123456789" android:singleLine = "true" android:ellipsize = "marquee" /> LinearLayout > |
INVISIBLE 不显眼的 用法
TestActivity.java
? public class TestActivity extends Activity { Button btn1; Button btn; @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.main); btn1 = (Button) this .findViewById(R.id.btn1); btn = (Button) this .findViewById(R.id.btn); btn.setOnClickListener( new OnClickListener(){ public void onClick(View v){ btn1.setVisibility(View.INVISIBLE); //换用GONE就会直接删除第一个按钮空间 }}); } } |
更多相关文章
- android:ellipsize的使用
- Android跑马灯效果,字体滚动滚屏效果
- android使用android:ellipsize="end"无效的解决方法
- android:layout_gravity与android:gravity区别
- 二、android百度地图定位显示当前位置(android百度地图SDK系列)
- 设置Textview最大长度,超出显示省略号
- 安卓设置文字自动滚动
- Android(安卓)layout xml总结
- Android之记录ListView的checkbox选择位置问题