2016-04-03 77 views
0

我有大約50幅圖像的ListView負載:Android的列表視圖放大不能左右滾動

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:padding="10dp" 
    android:background="@drawable/background"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:focusableInTouchMode="true"> 

     <ListView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/listViewImg"> 
     </ListView> 

    </LinearLayout> 

在活動

,該代碼變焦的ListView

final ListView lvi = (ListView)findViewById(R.id.listViewImg); 

    try { 
     XmlPullParserImg parser = new XmlPullParserImg(); 
     imgList = parser.parse(getAssets().open(get_xml)); 
     BinderDataImg binderdata = new BinderDataImg(this, imgHashmap); 
     lvi.setAdapter(binderdata); 

    }catch(IOException e) { 
    e.printStackTrace(); 
    } 

    FloatingActionButton fa1 = (FloatingActionButton) findViewById(R.id.fab1); 
    fa1.setOnClickListener(new View.OnClickListener() { 
    @Override 
    public void onClick(View v) { 
     float x1 = lvi.getScaleX(); 
     float y1 = lvi.getScaleY(); 
     lvi.setScaleX(x1 * 2); 
     lvi.setScaleY(y1 * 2); 
    } 
    }); 

我可以放大或縮小進入和縮小列表視圖。
放大時,我可以上下滾動listview,並且圖像比佈局大。
但我不能把它的滾動左,右(或向左或向右移動)
對不起我的英語不好
感謝讀取所有的佈局和ListView的

+0

顯示你的java ListViewAdapter代碼。這是不可能完全解決這個只有你的佈局xml代碼 –

+0

我在我的帖子更新 – abcd1234

回答

0

設置寬度爲wrap_content代替match_parent

+0

這是行不通的,仍然像這樣 – abcd1234

相關問題