安卓:隐藏的ImageViewImageView

2023-09-05 06:13:19 作者:い憚纞?這該死の澸覚♂

IHAVE一个imageveiw intially它应该是在隐藏模式下,

ihave a imageveiw intially it should be in hidden mode ,

<ImageView
            android:id="@+id/custom"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"    
            android:src="@drawable/custom1" />

和我创建了一个登录页面..whenever我的登录是成功,我应该显示的图像 任何建议将helpful..thankyou

and i created a login page ..whenever my login is success i should show the image Any suggestions will be helpful..thankyou

推荐答案

试试这个

您XML

<ImageView
            android:id="@+id/custom"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical|right"    
            android:src="@drawable/custom1" />

您可以在这里设置在这样的XML

You can set here on xml like this

android:visibility="visible"

android:visibility="invisible"

android:visibility="gone"

Java程序

Java program

ImageView imgView = (ImageView)findViewById(R.id.custom);

设置的ImageView 像这样

imgView .setVisibility(View.VISIBLE);

imgView .setVisibility(View.INVISIBLE);

imgView .setVisibility(View.GONE);

区别看不见 GONE

看不见 - 该部件将是不可见的,但空间小部件会显示

INVISIBLE - The widget will be invisible but space for the widget will be show.

GONE - 空间和小部件是不可见的。

GONE - Both space and widget is invisible.