gpt4 book ai didi

android - ViewFlipper 中的全屏图像

转载 作者:行者123 更新时间:2023-11-29 15:31:24 28 4
gpt4 key购买 nike

我的 xml 布局中有一个包含图像的 ViewFlipper。我想全屏显示这张图片。无论我为图像使用哪种 ScaleType,我都无法让图像全屏显示。

这是我的布局:

<?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>

这是我 Activity 中的代码:

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);

具有各种最小高度值但没有。

为什么图像没有全屏显示有什么想法吗?

最佳答案

尝试设置 yourImageView.setScaleType(ImageView.ScaleType.FIT_XY); 这对我有用并解决了我的问题。

关于android - ViewFlipper 中的全屏图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6162625/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com