我在 Android imageView Zoom-in and Zoom-Out 使用 ZoomableImageView (参见 Nicolas Tyler 的帖子)
我将 FrameLayout 用于重叠 View 技术。我希望球(带有 id 球的 ImageView)始终与(背景) map (带有 id map 的 ZoomableImageView)重叠。
布局是这样的:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<mypackage.ZoomableImageView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="matrix"
android:src="@raw/gamemap"
/>
<ImageView
android:id="@+id/ball"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@raw/ball"
/>
</FrameLayout>
球“附加”(“映射到”)到游戏 map 上的(可见)点(例如:PointF)。就像 map 应用程序一样,当我缩放背景(游戏 map )时,球需要相对于游戏 map 自动移动。因此,在缩放时,球在屏幕上是可见的还是不可见的。
我想按照我说的去做。我想检查球在屏幕上是可见的还是不可见的。我该怎么办?
最佳答案
您可以像这样检查任何 View 的可见性。
if(tvEndDate.getVisibility()==View.VISIBLE)
{
// do your stuff
}
关于android - 检查 View 在屏幕上是否可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30391100/