View.Invisible - 图像在屏幕上停留 [英] View.Invisible - images stay on the screen

查看:136
本文介绍了View.Invisible - 图像在屏幕上停留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置我的ImageView,按钮及TextView中的知名度。但是,他们还在那里当我运行该程序。
我试过View.GONE但只是删除所有的TextView,ImageView的和按钮。但我只是想隐藏,然后显示出来。

I trying to set visibility of my imageview , button and textview. But they still there when I run the program. I tried the View.GONE but that just remove all the textview, imageview and button. But I just want to hide and then show.

               list.setOnItemClickListener(new AdapterView.OnItemClickListener() 
            {
                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1,
                        int position, long arg3) 
                {
                                                if(baglanti.DegerDogruMu() == true)
                        {
                            ekvar = true; **// If true there is an attachment**
                            gelen = baglanti.EkinIsmi();
                        }
                        else
                        {
                            ekvar = false; **// False = no attachment**
                        }

                                }

然后,我把结果在意向。

final Intent intent = new Intent(ListeleActivity.this, GoruntuleActivity.class);
intent.putExtra(ekvarmı, ekvar);
startActivity(intent);

与其他活动
调用此方法与添加ekvar

    public void ListOnClicklendiginde(final int position , ArrayList<String> bodyliste , ArrayList<String> kimdenlist , ArrayList<String> konulist, boolean ekvarmı  , ArrayList<String> ekinismi)
        {
**// First I hide the "attachment things"**


   dosyaAdi.setVisibility(View.INVISIBLE);
        atacResim.setVisibility(View.INVISIBLE);
        ekButton.setVisibility(View.INVISIBLE);

**// If there is an attachment then visible the things. (I debug for the no attachment email and it fall the false so the statement is working ok)**


    if( ekvarmı == true)
                {
                    dosyaAdi.setVisibility(View.VISIBLE);
                    atacResim.setVisibility(View.VISIBLE);
                    ekButton.setVisibility(View.VISIBLE);

                }
                else
                {
                    dosyaAdi.setVisibility(View.INVISIBLE);
                    atacResim.setVisibility(View.INVISIBLE);
                    ekButton.setVisibility(View.INVISIBLE);
                }
                 }

XML:

<RelativeLayout
        android:id="@+id/ekTablo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_x="8dp"
        android:layout_y="102dp" >

        <ImageView
            android:id="@+id/imageViewAttachment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:src="@drawable/ic_email_attachment" />

        <TextView
            android:id="@+id/dosyaAdi"
            android:layout_width="210dp"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:textAppearance="?android:attr/textAppearanceLarge" />

        <ImageButton
            android:id="@+id/imageButtonEkIndir"
            android:layout_width="50dp"
            android:layout_height="16dp"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@+id/dosyaAdi"
            android:src="@drawable/ic_indir" />

    </RelativeLayout>

红色正方形
在图片,他们必须隐藏

The red squares At the picture they have to hide

推荐答案

尽量使你的意见的在XML无形并修改Java code这样的

Try to made your views invisible in XML and change your Java code like this

if( ekvarmı == true)
            {
                dosyaAdi.setVisibility(View.VISIBLE);
                atacResim.setVisibility(View.VISIBLE);
                ekButton.setVisibility(View.VISIBLE);

            }

这篇关于View.Invisible - 图像在屏幕上停留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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