【问题标题】:Adjusting Imageview size in the ImageGallery(thumbnail scroller) according to Screen Size根据屏幕大小调整 ImageGallery(缩略图滚动器)中的 Imageview 大小
【发布时间】:2013-10-18 15:41:50
【问题描述】:

我有带有小图像作为缩略图的图像库,目前我已经在 ImageAdapter 类中修复了图像的大小,并且它在 240 x 320 和 320 x 480 的小屏幕上完美可见。

但是图像在大屏幕中显示很小,就像在平板电脑或 Galaxy 中一样,那么我应该如何根据屏幕分辨率更改 imageview 大小。

谢谢

【问题讨论】:

    标签: android android-imageview image-gallery


    【解决方案1】:
    <GridView
            android:id="@+id/img_grid"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/back_up_layout"
            android:layout_margin="5dp"
            android:choiceMode="multipleChoice"
            android:columnWidth="100dp"
            android:fastScrollEnabled="true"
            android:horizontalSpacing="10dp"
            android:numColumns="4"
            android:stretchMode="columnWidth"
            android:verticalSpacing="10dp"
            android:visibility="gone" />
    

    使用它会根据屏幕大小自动调整 我认为它对你来说已经用完了:)

    【讨论】:

    • 但目前我正在使用画廊,你能告诉我如何在 LinearLayout 中做到这一点。我需要动态设置它
    • 然后使用这个代码密度= getResources().getDisplayMetrics().densityDpi; if(density==DisplayMetrics.DENSITY_LOW) getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);你可以根据屏幕尺寸获得所有屏幕尺寸,然后给出身高和体重的条件
    猜你喜欢
    • 1970-01-01
    • 2013-11-25
    • 1970-01-01
    • 2015-07-16
    • 2017-01-19
    • 1970-01-01
    • 2017-12-02
    相关资源
    最近更新 更多