Android Development Note ___textvieww__ Marquee effect

Source: Internet
Author: User

1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 android:orientation= "vertical"Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent">5 6     <TextView7         Android:layout_width= "Wrap_content"8 Android:layout_height= "Wrap_content"9 Android:text= "Demo effect"Ten Android:textcolor= "@color/text_color" One android:textsize= "25SP" A android:layout_gravity= "Center"/> -  -     <LinearLayout the         Android:layout_width= "Match_parent" - android:orientation= "vertical" - Android:layout_height= "250DP"> -  +         <TextView -             Android:layout_width= "Match_parent" + Android:layout_height= "Wrap_content" A Android:layout_margintop= "20DP" at android:gravity= "Center" - Android:text= "Marquee effect, click Pause, then click Restore"/> -  -         <TextView -             Android:layout_width= "Match_parent" - Android:layout_height= "Wrap_content" in Android:id= "@+id/tv_marquee" - Android:layout_margintop= "20DP" to Android:singleline= "true" + android:ellipsize= "Marquee" - android:focusable= "true" the Android:focusableintouchmode= "true" * Android:textcolor= "#000000" $ android:textsize= "17SP"Panax Notoginseng Android:text= "Flash: Red warning, ultra-high temperature is coming, please turpan residents close doors and windows, holds stocks fodder, open air conditioning, to prepare for flood relief!" "/> -  the         <Button +             Android:layout_width= "Wrap_content" A Android:layout_height= "Wrap_content" the Android:text= "chat room effect" + Android:layout_margintop= "10DP" - Android:id= "@+id/btn_liaotianshi"/> $  $     </LinearLayout> -  -     <TextView the         Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content"Wuyi Android:text= "Main Content" the Android:textcolor= "@color/text_color" - android:textsize= "25SP" Wu android:layout_gravity= "Center"/> -  About     <ScrollView $         Android:layout_width= "Match_parent" - Android:layout_height= "Wrap_content"> -  -         <TextView A             Android:textcolor= "@color/text_color" + Android:text= "1." The marquee effect is first set to a single line (Singleline), and then the ellipsis is set beyond the range (there are three kinds: 1, start 2, Middle 3, end, when set to marquee is the marquee effect). Also need to get focus, set focusable=true,focusableintouchmode=true\n\n2, chat room effect \nscrollbars is vertical, set the set Movementmethod in code "  the Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content" /> $  the     </ScrollView> the  the </LinearLayout>

Java

1  PackageCom.example.alimjan.hello_world;2 3 Importandroid.app.Activity;4 ImportAndroid.content.Context;5 Importandroid.content.Intent;6 ImportAndroid.os.Bundle;7 Importandroid.support.annotation.Nullable;8 ImportAndroid.view.View;9 ImportAndroid.widget.Button;Ten  One /** A * Created by Alimjan on 6/30/2017. -  */ -  the  Public classClass__2_3_1extendsActivity { -     PrivateButton lts; - @Override -     protected voidonCreate (@Nullable Bundle savedinstancestate) { +         Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.code_2_3_1); +  ALTS =(Button) Findviewbyid (R.id.btn_liaotianshi); at  -Lts.setonclicklistener (NewView.onclicklistener () { - @Override -              Public voidOnClick (View v) { -Intent Intent =NewIntent (Class__2_3_1. This, Class__2_3_1_2.class); -Class__2_3_1. This. StartActivity (intent); in             } -         }); to  +     } -  the      Public Static voidstarthome (Context mcontext) { *Intent Intent =NewIntent (Mcontext, Class__2_3_1.class); $ mcontext.startactivity (intent);Panax Notoginseng     } -}

Android Development Note ___textvieww__ Marquee effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.