当前位置:网站首页>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>

边栏推荐
- Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
- [fan Tan] those stories that seem to be thinking of the company but are actually very selfish (I: building wheels)
- 第2章搭建CRM项目开发环境(搭建开发环境)
- 科普达人丨一文弄懂什么是云计算?
- 第2章搭建CRM项目开发环境(数据库设计)
- Mysql 索引命中级别分析
- rpcms获取指定分类下的文章的方法
- First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
- VSCode关于C语言的3个配置文件
- DevOps 的运营和商业利益指南
猜你喜欢
随机推荐
SlashData开发者工具榜首等你而定!!!
【分布式理论】(二)分布式存储
actionBar 导航栏学习
管理VDI的几个最佳实践
Flask搭建api服务
Jenkins发布uniapp开发的H5遇到的问题
What is cloud computing?
L1-028 判断素数(Lua)
DevOps 的运营和商业利益指南
The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
Matplotlib绘图界面设置
Flash build API Service - generate API documents
Skimage learning (3) -- adapt the gray filter to RGB images, separate colors by immunohistochemical staining, and filter the maximum value of the region
数值 - number(Lua)
【可信计算】第十三次课:TPM扩展授权与密钥管理
Flask build API service SQL configuration file
Several best practices for managing VDI
A tour of grpc:03 - proto serialization / deserialization
专精特新软件开发类企业实力指数发布,麒麟信安荣誉登榜
Flask搭建api服务-SQL配置文件









