当前位置:网站首页>Function and usage of textswitch text switcher
Function and usage of textswitch text switcher
2022-07-07 17:36:00 【XLMN】
textSwitch Function and usage of text switcher
testswitch Inherited viewswitch, Therefore, possession and viewswitcher Same features , You can switch view Use animations for components ,
testswitcher and imageview Acquaintance requires a viewfactory, The difference is ,testswitcher need viewfactory Of makeview Return to one textview Components
public class MainActivity extends Activity {
TextSwitcher ts;
String[] str=new String[]{
“mia”,“love mia”,“miss mia”,“010802”
};
int curstr;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.textswitcher);
ts = (TextSwitcher) findViewById(R.id.textswitcher);
ts.setFactory(new ViewFactory() {
@Override
public View makeView() {
// TODO Auto-generated method stub
TextView tv=new TextView(MainActivity.this);
tv.setTextSize(40);
tv.setTextColor(Color.MAGENTA);
return tv;
}
});
next(null);
}
// Define processing functions , Controls the display of the next string
public void next(View source) {
ts.setText(str[curstr++%str.length]);
}
}
<?xml version="1.0" encoding="utf-8"?><!-- Define a testswitcher, And specify the animation effect when text switching -->
<TextSwitcher
android:id="@+id/textswitcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inAnimation="@android:anim/slide_in_left"
android:onClick="next"
android:outAnimation="@android:anim/slide_out_right" >
</TextSwitcher>
边栏推荐
- 命令模式 - Unity
- The mail server is listed in the blacklist. How to unblock it quickly?
- The top of slashdata developer tool is up to you!!!
- 自定义View必备知识,Android研发岗必问30+道高级面试题
- 99% of users often make mistakes in power Bi cloud reports
- 使用 xml资源文件定义菜单
- 科普达人丨一文弄懂什么是云计算?
- NeRF:DeepFake的最终替代者?
- 【网络攻防原理与技术】第3章:网络侦察技术
- 第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
猜你喜欢
LeetCode刷题day49
How to choose the appropriate automated testing tools?
第3章业务功能开发(实现记住账号密码)
Leetcode brush questions day49
【信息安全法律法规】复习篇
麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
Mrs offline data analysis: process OBS data through Flink job
【网络攻防原理与技术】第5章:拒绝服务攻击
第2章搭建CRM项目开发环境(数据库设计)
随机推荐
99% 用户在 Power BI 云端报表常犯错误
Several best practices for managing VDI
Matplotlib绘图界面设置
管理VDI的几个最佳实践
Establishment of solid development environment
麒麟信安中标国网新一代调度项目!
On Apache Doris Fe processing query SQL source code analysis
【信息安全法律法规】复习篇
【饭谈】那些看似为公司着想,实际却很自私的故事 (一:造轮子)
自定义View必备知识,Android研发岗必问30+道高级面试题
【TPM2.0原理及应用指南】 5、7、8章
Skimage learning (1)
Lex & yacc of Pisa proxy SQL parsing
L1-019 谁先倒(Lua)
【可信计算】第十三次课:TPM扩展授权与密钥管理
【网络攻防原理与技术】第1章:绪论
LeetCode 890(C#)
User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions
mysql实现两个字段合并成一个字段查询
策略模式 - Unity