2014-11-02 34 views
0

意外保證金所以我有一個ParseImageView這是ImageView,它被包含在一個容器中充當覆蓋一個子類。容器的可見性靜態設置爲GONE,但當單擊ScrollView內的該圖片的裁剪版本時,將其更改爲可見。爲ImageView的

這一切工作正常,但expanded_image_view具有不必要的利潤率左右,其中作物塊出形象,我似乎無法弄清楚爲什麼會發生。有什麼我做錯了嗎?

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
     android:id="@+id/post_data"> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/scrollView2" > 

      <!-- some linear layouts here--> 
     </ScrollView> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/expanded_image_container" 
     android:visibility="gone" 
     android:background="@color/black" 
      android:gravity="center_vertical|center_horizontal"> 

    <com.parse.ParseImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/expanded_image_view" 
     android:paddingTop="15dp" 
     android:paddingBottom="15dp" 
     android:scaleType="centerInside" 
     android:adjustViewBounds="false" 
     /> 
</LinearLayout> 


    </FrameLayout> 
+0

嘗試將android:scaleType更改爲fitXY – 2014-11-02 14:02:45

+0

嘿,它工作!我可否知道爲什麼需要fitXY?我很確定我的圖像應該和設備的屏幕一樣大。 – plsnoban 2014-11-02 14:05:31

+0

太棒了! :)好吧,我試圖解釋我所知道的答案。請接受它。謝謝 – 2014-11-02 14:11:07

回答

0

android:scaleType更改爲fitXY。如果你使用centerInside,你的圖像將被強制置於中心位置,android會被剪切掉,所以它會位於中心。