开发者

How to disable UI Components in android?

开发者 https://www.devze.com 2023-03-08 01:59 出处:网络
In my app when i am making service call i am just displaying the spinnerdialog or ProgressBarProcess but when it is displayed on the screen the Activity is able to take the events so that it is causin

In my app when i am making service call i am just displaying the spinnerdialog or ProgressBarProcess but when it is displayed on the screen the Activity is able to take the events so that it is causing to force close the app(App not responding). How to solve this issue. how i am can disable the total UI 开发者_Python百科components of the activity??


doesn't seems any direct solution for this. but you use one trick while creating xml layout of screen

Put your entire screen in FrameLayout and and an ImageView just below your view

<FrameLayout>
   <YourLayout></YourLayout>
   <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" />
</FrameLayout>

set imageview visibility invisible and also alpha transparency 0 at first and register touch event of activity.

when you need to disable your event at that time make it visible and in onTouch event check it's id and do nothing in that block

0

精彩评论

暂无评论...
验证码 换一张
取 消