更新runOnUiThread中的textview文本与先前设置的文本重叠

时间:2019-01-17 06:17:17

标签: android textview android-runonuithread

我想用textview中的mediaplayer.getCurrentPosition()设置runOnuiThread()文本。但是问题在于更新后的文本与先前设置的文本重叠。

我是android的新手,想在我给定的一段时间后以编程方式更改文本

onCreate方法

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_image_content_pop_up);

        imageUrl=new ArrayList<>();
        for(int i=1;i<=3;i++)
        {
            imageUrl.add("https://www.gstatic.com/webp/gallery3/"+i+".png");
        }
        LinearLayoutManager layoutManager=new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
        recyclerImagevIew=(RecyclerView)findViewById(R.id.image_recycler_view);
        recyclerImagevIew.setLayoutManager(layoutManager);
        ImagePopupAdapter imagePopupAdapter =new ImagePopupAdapter(this,imageUrl);
        recyclerImagevIew.setAdapter(imagePopupAdapter);
        background_Image=(ImageView) findViewById(R.id.background_image);
        cross_sign =(TextView)findViewById(R.id.cross_button);
        cross_sign.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
      //  StartAsyncTask();
       // StartTimer();

        handler=new Handler();
        runnable= new Runnable() {
            @Override
            public void run() {
                if(index<imageUrl.size()) {
                    Glide.with(getApplicationContext()).load(imageUrl.get(index)).into(background_Image);
                    index++;
                    handler.postDelayed(runnable, 5000);
                }
            }
        };
        handler.postDelayed(runnable,1000);




    }

see image here

0 个答案:

没有答案