For more highlights, please click to read: APIDemos2.3 learning notes in TextView and its subclass controls. When the text content is too long and exceeds the control length, by default, the text cannot be fully displayed. In this case, by setting the android: ellipsize attribute of the control in the xml layout file, you can use the ellipsis to represent the undisplayed parts,
For more highlights, please click to read: API Demos 2.3 Learning notes in TextView and its subclass controls. When the text content is too long and exceeds the control length, by default, the text cannot be fully displayed. In this case, by setting the android: ellipsize attribute of the control in the xml layout file, you can use the ellipsis to represent the undisplayed parts,
For more highlights, click to read:API Demos 2.3 Study Notes
In TextView and its subclass controls, when the text content is too long to exceed the control length, the text content cannot be fully displayed by default. In this case, you can set the android: ellipsize attribute of the control in the xml layout file to indicate undisplayed parts with ellipsis and place them at the beginning, middle, or end of the text; you can also run a Trojan to display text (that is, when the text control gets the focus, the text will be displayed in a scroll manner ). The specific setting method is as follows:
1. Not handled by default
android:singleLine="true"android:ellipsize="none"
2. Place the ellipsis at the beginning
android:singleLine="true"android:ellipsize="start"
3. Place the ellipsis in the middle
android:singleLine="true"android:ellipsize="middle"
4. Put the ellipsis at the end
android:singleLine="true"android:ellipsize="end"
5. Running Horse lights
android:focusable="true"android:focusableInTouchMode="true"android:singleLine="true"android:ellipsize="marquee"android:marqueeRepeatLimit="marquee_forever"
Note: 1. android: singleLine = "true" indicates single row display.
2. When setting the flashlight effect, it is best to add android: focusable = "true" and android: focusableInTouchMode = "true" to indicate that the focus can be obtained, respectively, and obtain the focus in touch mode.
3. android: marqueeRepeatLimit indicates the number of times that the running horse lights are repeatedly displayed. The value can only be marquee_forever or a positive integer. When the value is marquee_forever, it indicates that the running horse lights are repeatedly displayed.
Next we will analyze the instance code:
Res-value-string.xml
This use the default marquee animation limit of 3
This will run the marquee animation once
This will run the marquee animation forever
Res-layout-marquee.xml
Src-com.example.android.apis.text-Marquee.java
Package com. example. android. apis. text; import com. example. android. apis. r; import android. app. activity; import android. OS. bundle; public class Marquee extends Activity {@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // render a View object from the marquee layout file and use it as the default View setContentView (R. layout. marquee );}}
Effect preview: