如何在android中弹出一些部分图像

Zal*_*inh 10 android image imageview

我想要显示图像的某些部分.就像一本漫画书.我有一个像这样的图像.

这是实际的形象.

当我点击图像时,某些部分显示如下.

单击此部分图像时的第二个图像.

我想显示这种类型.在这个过程中,我创建了一些包含主图像图像部分的zip文件.我完成了显示每个图像序列.但我的问题是如何获得实际图像的任何部分点击并在第二个屏幕显示这个?

我无法获得图像部分ID.那么如何获得这部分图像ID.

所以请帮帮我.我卡住了.

And*_*123 0

你可以用一个技巧来解决这个问题。

在布局内设置按钮(背景为透明)。

设置按钮的 OnclickListener 以显示您想要在课堂活动中显示的弹出窗口。

您还可以根据您的要求按可见/不可见功能管理按钮单击事件。

已编辑

您的 xml 将如下所示。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/YOUR_IMAGE" >

    <Button
        android:id="@+id/btn_invisible"
        android:layout_width="85dp" 
        android:layout_height="30dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="18dp"
        android:background="@android:color/transparent" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

以及 Activity 类的 OnCreate() 方法内部。

   @Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();

    setContentView(R.layout.help_1);
    btn_invisible = (Button) findViewById(R.id.btn_invisible);
    btn_invisible.setOnClickListener(this);
}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub

    if (v == btn_invisible) {
        //Whatever Code you want to Use for Show Popups

    }
Run Code Online (Sandbox Code Playgroud)

我不确定,但你可以尝试一次。