android中的(singleLine)單行顯示 none start middle

來源:互聯網
上載者:User

第一個button 什麼都沒寫。   後面省略符號

android:ellipsize="none"   none就沒有省略符號了

android:ellipsize="start"  省略好放到起始的位置

android:ellipsize="middle" 省略符號放到中間的位置

android:ellipsize="end"     省略符號房子尾部的位置

android:ellipsize="marquee"   跑馬燈效果,從左往右的跑馬燈效果

 

<?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就會直接刪除第一個按鈕空間        }});    }}

  

 

  點擊05古天樂  第一個按鈕消失,但是還佔用哪個空間  ,

       換用GONE就會直接刪除第一個按鈕空間

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.