zoukankan      html  css  js  c++  java
  • 团队开发冲刺日(七)

      图片上传部分UI横向滚动:GridView+HorizontalScrollView问题

    上上篇博客中我使用的图片上传排版是使用GridView进行展示,但多图片的情况下它会在当前页面另起一行继续展示,我需要在这个界面补上输入正文部分,显然是不能这么展示的。因此需要在UI设计上做出一些对策,上网查阅选择使用HorizontalScrollView解决,但出现了问题:

     1 <HorizontalScrollView
     2         android:layout_width="match_parent"
     3         android:layout_height="wrap_content">
     4         <LinearLayout
     5             android:layout_width="match_parent"
     6             android:layout_height="wrap_content"
     7             android:layout_margin="10dp">
     8     <com.example.toa.MyGridView
     9         android:id="@+id/gridView"
    10         android:layout_width="match_parent"
    11         android:layout_height="wrap_content"
    12         android:layout_margin="5dp"
    13         android:layout_weight="111"
    14         android:columnWidth="90dp"
    15         android:gravity="center"
    16         android:horizontalSpacing="5dp"
    17         android:numColumns="4"
    18         android:stretchMode="columnWidth"
    19         android:verticalSpacing="5dp"
    20         ></com.example.toa.MyGridView>
    21         </LinearLayout>
    22     </HorizontalScrollView>

    这是使用HorizontalScrollView包裹了GridView控件,但是预览效果并不对劲:

     原来没有添加控件时,效果是这样的:

     经过查阅发现这里使用方法需要重写适配器,光改动xml是不行的,而且在改动xml的时候也出现了一些问题,最后总结一下就是HorizontalScrollView>Linearlayout>GridView这个结构进行。现在的进度是在重新编写适配器,对java代码部分的整改。

    补充昨天学习的知识:

    Android存取MySQL数据库的图片信息:参考博客:https://blog.csdn.net/qq_34119967/article/details/99864544

    这篇博客使用的应该是轻量级的SQLite数据库,我们选择Android+Servlet进行服务器MySQL数据库的连接,之前提到过Android存入图片需要将图片信息交给Servlet进行预处理文件路径再上传,这里结合博客思路,使用Servlet将图片信息传给Android,再使用Bitmap回显即可。关于Android连接数据库的代码,我会参照之前的疫情显示进行相应修改。主要用的是HttpURLConnection,有些博客介绍了OKHttp,但目前还没能掌握。。。

  • 相关阅读:
    奇数阶魔方问题
    《DSP using MATLAB》示例9.3
    《DSP using MATLAB》示例9.2
    《DSP using MATLAB》示例9.1
    找个目标很重要
    《DSP using MATLAB》示例Example 8.30
    《DSP using MATLAB》示例Example 8.29
    《DSP using MATLAB》示例Example 8.28
    《DSP using MATLAB》示例Example 8.27
    《DSP using MATLAB》示例Example 8.26
  • 原文地址:https://www.cnblogs.com/20183711PYD/p/12732485.html
Copyright © 2011-2022 走看看