Android的画廊全屏全屏、画廊、Android

2023-09-06 09:54:28 作者:敷衍怎么演

我如何实现全屏画廊?即图像拉伸,以填补所有的屏幕?

How do I implement a fullscreen gallery? i.e. image stretches to fill all the screen?

推荐答案

要使它全屏:

        <activity android:name="YourActivity" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

,使图像填充,你应该去做你的适配器上的屏幕上,创建具有MATCH_PARENT x MATCH_PARENT和你在getView创建您的ImageView视图你应该让填补所有的空间:

To make the images fill the screen you should do it on your adapter, creating a View with MATCH_PARENT x MATCH_PARENT and in your ImageView you created on getView you should make it fill all the space:

yourImageView.setScaleType(ImageView.ScaleType.FIT_XY);