2011-05-28 67 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