2011-05-28 56 views
1

我在我的xml佈局中包含一個ImageFlipper。我想全屏顯示此圖像。無論我使用哪種ScaleType作爲圖像,我都無法讓圖像顯示全屏。ViewFlipper中的全屏圖像

這是我的佈局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <ViewFlipper android:layout_height="fill_parent" android:id="@+id/flipperView" android:layout_width="fill_parent"> 
     <FrameLayout android:id="@+id/frameLayout1" android:layout_height="fill_parent" android:layout_width="fill_parent"> 
      <ImageView android:src="@drawable/my_drawable" android:id="@+id/bcImageView" android:layout_width="fill_parent" android:layout_gravity="center" android:scaleType="fitCenter" android:layout_height="wrap_content"></ImageView> 
     </FrameLayout> 
    </ViewFlipper>  

</LinearLayout> 

而且這是在我的活動代碼:

protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    // Force landscape mode 
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 

    // Hide window title and go fullscreen 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 

    setContentView(R.layout.flippertest); 

    mViewFlipper = (ViewFlipper) findViewById(R.id.flipperView); 
    mViewFlipper.setFocusableInTouchMode(true); 
    mViewFlipper.requestFocus(); 
    mViewFlipper.setOutAnimation(this, android.R.anim.slide_out_right); 
    mViewFlipper.setInAnimation(this, android.R.anim.slide_in_left); 

我使用也嘗試:

mViewFlipper.setClipChildren(false); 
    mViewFlipper.setMinimumHeight(300); 

用的各種值最小高度但沒有。

任何想法爲什麼圖像不顯示全屏?

+0

你有沒有得到這個工作?有類似的問題 – Bex 2011-07-06 15:49:51

+0

不行,我重新設計了完全的用戶界面。 – 2011-07-07 07:53:53

+0

正考慮同樣的事情! – Bex 2011-07-07 09:01:10

回答

1

更改您的ImageView android:layout_height="wrap_content"android:layout_height="fill_parent"在佈局

+0

嗨Egor,我已經試過了,它不起作用。 – 2011-05-28 23:45:20

2

嘗試設置yourImageView.setScaleType(ImageView.ScaleType.FIT_XY);這爲我工作和解決我的問題。

+1

它幫我一部分.. – 2013-04-26 10:54:49