横屏,多张图片的左右滑动展示

无也南乐 2015-03-18 11:50:15
我现在在用gridview在做,始终达不到效果,gridview内的图片一直都是纵向显示的。滑动也是纵向的。
适配器是这么定义的:
public class ImageAdapter extends BaseAdapter implements OnScrollListener{}
将所有图片通过网络下载,装载到适配器,然后在gridview显示。
布局文件始终没有调整好。

因为我这个会涉及到很多图片,首先请问这样做是否是对的,
其次,是否有其他更好的做法,viewflipper?
...全文
996 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
你的布局太繁琐了,嵌套太多,影响效率。可以用画廊grally来实现的,很方便
无也南乐 2015-03-18
  • 打赏
  • 举报
回复
引用 2 楼 bdmh 的回复:
估计是你布局有问题,viewflipper可以用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".DetailActivity" >

    <HorizontalScrollView
        android:id="@+id/content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="10dip"
        android:scrollbars="none" >

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent" >

            <LinearLayout
                android:id="@+id/mLinearLayout"
                android:layout_width="1100dp"
                android:layout_height="fill_parent"
                android:layout_gravity="center_vertical"
                android:layout_marginTop="5dip"
                android:orientation="horizontal" >

                <GridView
                    android:id="@+id/mDiviceListContainer"
                    android:listSelector="@null"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:columnWidth="150dp"
                    android:horizontalSpacing="10dp"
                    android:numColumns="auto_fit"
                    android:stretchMode="none"
                    android:verticalSpacing="1dp" >
                </GridView>
            </LinearLayout>
        </FrameLayout>
    </HorizontalScrollView>

</LinearLayout>
用这个可以实现横向滑动,但不是单行的,也可以纵向滑动
bdmh 2015-03-18
  • 打赏
  • 举报
回复
估计是你布局有问题,viewflipper可以用
无也南乐 2015-03-18
  • 打赏
  • 举报
回复
求大神指教~~

80,471

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧