我们可以在Android的移动任何对象,线程 [英] Can we move any object in android with thread

查看:101
本文介绍了我们可以在Android的移动任何对象,线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像是我的code但这是线程去preciated方法

具有误差

 类X实现了线程{
公共无效的run()
{
 someButton.layout(10,K,40,40); K + = 10;
}}


解决方案

是的,我们可以,但这个原因,你必须使用用户界面线程

  runOnUiThread(新的Runnable(){
                        @覆盖
                        公共无效的run(){
                            //做你的东西在这里
                        }
                 });

like is my code but this is having error of depreciated method of threads

class x implements Threads{
public void run()
{
 someButton.layout(10,k,40,40);

 k+=10;
}}

解决方案

Yes we can but that reason you have to use user interface thread

runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            // do your stuff here
                        }
                 });

这篇关于我们可以在Android的移动任何对象,线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆