Android 点击预览缩略图以查看高分辨率图像

Android 点击预览缩略图以查看高分辨率图像,android,menu,zooming,imagebutton,Android,Menu,Zooming,Imagebutton,我是一名新的安卓开发者,我正在尝试为安卓创建一个安卓应用程序,其中将显示菜单项以及描述成本和图像。 我已经实现了列表活动来显示列表中的项目。我制作了一个图像按钮,它将在缩略图中显示图像。当我点击图像按钮时,我希望能够查看缩略图的高分辨率图像。我已经实现了一个onClickListener来监听tap事件,但是我不知道如何在tap时缩小图像 我跟着 但这是相当模糊的理解。Animator类不存在。有人能带我出去吗?我搜索了将近一周后找到了解决方案。 I found the solution aft

我是一名新的安卓开发者,我正在尝试为安卓创建一个安卓应用程序,其中将显示菜单项以及描述成本和图像。 我已经实现了列表活动来显示列表中的项目。我制作了一个图像按钮,它将在缩略图中显示图像。当我点击图像按钮时,我希望能够查看缩略图的高分辨率图像。我已经实现了一个onClickListener来监听tap事件,但是我不知道如何在tap时缩小图像

我跟着

但这是相当模糊的理解。Animator类不存在。有人能带我出去吗?

我搜索了将近一周后找到了解决方案。
I found the solution after searching for almost a week.
I used PopupWindow Class for the purpose
Following is the Java Code.

PopupWin.java
public class PopupWin extends Activity{

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            final Button bPopup = (Button)findViewById(R.id.openpopup);
            bPopup.setOnClickListener(new Button.OnClickListener(){

       @Override
       public void onClick(View arg0) {
        LayoutInflater layoutInflater 
         = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);  
        View popupView = layoutInflater.inflate(R.layout.popup, null);  
                 final PopupWindow popupWindow = new PopupWindow(
                   popupView, 
                   LayoutParams.MATCH_PARENT,  
                         LayoutParams.MATCH_PARENT);  

                 Button bDismiss = (Button)popupView.findViewById(R.id.dismiss);
                 bDismiss.setOnClickListener(new Button.OnClickListener(){

         @Override
         public void onClick(View v) {
          // TODO Auto-generated method stub
          popupWindow.dismiss();
         }});

                 popupWindow.showAsDropDown(bPopup, 50, -30);

       }});
        }
    }


popup.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pop"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/dim_back" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/dim_back"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="20dp"
            android:orientation="vertical" 
            android:layout_gravity="center">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:adjustViewBounds="true"
                android:src="@drawable/appetimg01" />

            <Button
                android:id="@+id/dismiss"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="20sp"
                android:text="Go Back"
                android:textStyle="bold" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/appetizerDes1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_weight="0.40"
            android:text="Tap the Image to view High Resolution Image."/>

        <Button
            android:id="@+id/openpopup"
            android:layout_width="80sp"
            android:layout_height="80sp"
            android:layout_gravity="right"
            android:layout_margin="40sp"
            android:background="@drawable/custombutton"
            android:scaleType="centerCrop" />
    </LinearLayout>

</LinearLayout>

The background was appearing white but I wanted it transparent for which I created back_dim.xml in drawables and set it along with android:background="@drawable/back_dim". 
为此,我使用了PopupWindow类 下面是Java代码。 java 公共类PopupWin扩展了活动{ /**在首次创建活动时调用*/ @凌驾 创建时的公共void(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); 最终按钮bPopup=(按钮)findViewById(R.id.openpopup); bPopup.setOnClickListener(新建按钮.OnClickListener(){ @凌驾 公共void onClick(视图arg0){ LayoutInflater LayoutInflater =(LayoutInflater)getBaseContext().getSystemService(布局\充气器\服务); View popupView=LayoutFlater.inflate(R.layout.popup,null); 最终PopupWindow PopupWindow=新PopupWindow( 弹出视图, LayoutParams.MATCH_父级, LayoutParams.MATCH_PARENT); 按钮bDismiss=(按钮)popupView.findViewById(R.id.discouse); bDismiss.setOnClickListener(新建按钮.OnClickListener(){ @凌驾 公共void onClick(视图v){ //TODO自动生成的方法存根 popupWindow.disclose(); }}); 弹出窗口显示下拉列表(bPopup,50,-30); }}); } } popup.xml main.xml 背景看起来是白色的,但我希望它是透明的,为此我在drawables中创建了back_dim.xml,并将其与android:background=“@drawable/back_dim”一起设置。
Animator类确实存在,它是在API 11中添加的。你的目标是什么API?我的API版本是8。我想这就是为什么动画师不工作的原因。还有其他方法可以做同样的工作吗?在Android中,实际上有很多方法可以制作动画。我会四处寻找其他动画教程,或者你可以使用Jake Wharton的backport库NineolandRoids,我必须嵌入代码来放大和缩小多个页面。我差不多有8页了。每个上至少有三个项目。我想为每个项目的缩略图编写代码。如果你能给我找点简单的,那就太好了。先发制人