2012-01-06 62 views
-1

我想开发一个小册子应用程序,在这个应用程序中,任何人都可以通过将它们从一张照片滑动(或滚动)到另一张照片来浏览各种照片。这是我打到路障的地方。我需要知道我需要使用什么方法(例如OnClickListener)来实现。我还想添加额外的UI功能(例如捏缩放,限制视图到风景),你可以指导我一些教程。如果你之前从事过这样的应用程序,能否告诉我你在工作时遇到了什么问题。在android中创建一个简单的小册子应用程序

我在一个问题上问了很多。只要告诉我什么是重要的,以及如何处理我可能面临的问题。

谢谢您的输入和时间:)

+2

可能这会帮助你开始。 http://www.androidpeople.com/android-gallery-imageview-example – kosa 2012-01-06 04:55:59

+0

thinksteep ....你能告诉我什么方法执行从一个图像到另一个图像的轻弹动作?提供的例子很好,但我想要的是通过在屏幕上滑动手指来改变图像。有没有特别的方法? – Vinoth 2012-01-06 06:29:04

回答

1

首先,你从下面的代码实现图库查看:

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

    <FrameLayout android:id="@+id/frameLayout2" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:background="#ffffff"> 
     <LinearLayout android:id="@+id/LinearLayout01" 
      android:layout_width="fill_parent" android:layout_height="fill_parent" 
      android:orientation="vertical" android:layout_marginBottom="60dip"> 
      <Gallery xmlns:android="http://schemas.android.com/apk/res/android" 
       android:id="@+id/examplegallery" android:layout_height="wrap_content" android:layout_width="fill_parent"/> 
      <FrameLayout android:id="@+id/fr" android:layout_width="fill_parent" 
      android:layout_height="150dip"> 
      <ImageView android:id="@+id/ImageView01" 
      android:layout_gravity="center_horizontal" 
       android:layout_width="200dip" android:layout_height="200dip"/></FrameLayout> 
     </LinearLayout> 

    </FrameLayout> 

</LinearLayout> 


public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.grid_greetings); 
     imgView = (ImageView)findViewById(R.id.ImageView01); 
     btn_capture = (Button)findViewById(R.id.btn_Grid_Capture); 
     btn_preview = (Button)findViewById(R.id.btn_Grid_PreviewGreeting); 
     imgView.setImageResource(Imgid[0]); 
      bundle = getIntent().getExtras(); 
      gallery = (Gallery) findViewById(R.id.examplegallery); 
      gallery.setAdapter(new AddImgAdp(this)); 

      gallery.setOnItemClickListener(new OnItemClickListener() { 
       public void onItemClick(AdapterView parent, View v, int position, long id) { 
        imgView.setImageResource(Imgid[position]); 
        img_position = position; 
       } 
      }); 


    } 

通过这个链接然后去捏和缩放: android pinch zoom

相关问题