中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

TextView實(shí)現(xiàn)跑馬燈效果

2018-07-20    來源:open-open

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬Linux鏡像隨意使用

使用TextView簡(jiǎn)單實(shí)現(xiàn)燈箱跑馬燈效果:

直接上代碼:activity_main.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
        xmlns:tools="http://schemas.android.com/tools"  
        android:layout_width="match_parent"  
        android:layout_height="match_parent"  
        tools:context="com.example.t.MainActivity" >  
      
        <TextView  
            android:id="@+id/notice"  
            android:layout_width="fill_parent"  
            android:layout_height="fill_parent"  
            android:ellipsize="marquee"//以橫向滾動(dòng)方式顯示(需獲得當(dāng)前焦點(diǎn)時(shí))  
            android:focusable="true"//允許獲取焦點(diǎn)  
            android:focusableInTouchMode="true"//設(shè)置是否觸摸模式。  
            android:gravity="center"  
            android:marqueeRepeatLimit="marquee_forever"//一直滾動(dòng)  
            android:scrollHorizontally="true"//設(shè)置文本超出TextView長(zhǎng)度的情況下,是否出現(xiàn)橫拉條  
            android:singleLine="true"//單行顯示  
            android:textSize="20sp"  
            android:textColor="#FF0000"  
            android:text="回收二手航母、導(dǎo)彈、潛艇、坦克、翻新原子彈啦。。。..."  
            android:textStyle="bold" />  
      
    </RelativeLayout>  

JAVA代碼:MainActivity.java
    package com.example.t;  
      
    import android.app.Activity;  
    import android.os.Bundle;  
    import android.view.Menu;  
    import android.view.MenuItem;  
    import android.view.Window;  
      
    public class MainActivity extends Activity {  
      
        @Override  
        protected void onCreate(Bundle savedInstanceState) {  
            super.onCreate(savedInstanceState);  
            requestWindowFeature(Window.FEATURE_NO_TITLE);//無標(biāo)題  
            setContentView(R.layout.activity_main);  
        }  
      
        @Override  
        public boolean onCreateOptionsMenu(Menu menu) {  
            // Inflate the menu; this adds items to the action bar if it is present.  
            getMenuInflater().inflate(R.menu.main, menu);  
            return true;  
        }  
      
        @Override  
        public boolean onOptionsItemSelected(MenuItem item) {  
            // Handle action bar item clicks here. The action bar will  
            // automatically handle clicks on the Home/Up button, so long  
            // as you specify a parent activity in AndroidManifest.xml.  
            int id = item.getItemId();  
            if (id == R.id.action_settings) {  
                return true;  
            }  
            return super.onOptionsItemSelected(item);  
        }  
    }  

轉(zhuǎn)自:http://blog.csdn.net/xdwyyan/article/details/40835565

標(biāo)簽: 代碼

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇: Android 獲取網(wǎng)絡(luò)狀態(tài)

下一篇: Android 獲取ID號(hào),本機(jī)號(hào)碼,手機(jī)型號(hào),系統(tǒng)版本