如何使行高适合GridView中最高的项目?

因为默认情况下它是失败的.

更新:

这里是网格布局

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:id="@+id/gird"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:fadeScrollbars="false"

android:horizontalSpacing="5dip"

android:numColumns="3"

android:verticalSpacing="5dip" />

这是网格项的布局

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:background="@drawable/grid_item_background"

android:textColor="#000000" />

这是网格项的背景画

android:angle="270"

android:endColor="#F2DBA7"

android:startColor="#F2DBA7" />

android:bottom="5dip"

android:left="5dip"

android:right="5dip"

android:top="5dip" />

这是活动的源代码

import android.app.Activity;

import android.os.Bundle;

import android.widget.ArrayAdapter;

import android.widget.GridView;

public class GridActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

GridView grid = (GridView) findViewById(R.id.gird);

ArrayAdapter answeredWords = new ArrayAdapter(this,

R.layout.grid_item);

grid.setAdapter(answeredWords);

answeredWords.add("123456789101234567891012345678910");

answeredWords.add("12345678910");

answeredWords.add("12345678910123456789101234567891012345678910");

answeredWords.add("12345678910");

answeredWords.add("12345678910123456789101234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("1234567891012345678910");

answeredWords.add("123456789101234567891012345678910");

answeredWords.add("123456789101234567891012345678910");

}

}

更新:

我重写了GridView,他发现元素行的最大高度,并将此行的所有元素设置为相同的高度.

android行高,android – GridView的行高相关推荐

  1. android高度混淆,android – TextView与ImageSpan混淆行高

    我有一个文本填充文本,应该包含一些 ImageSpan对象.图像可能高于法线高度,导致以下问题: >如果图像是一行的最后一个对象,则以下行的高度是正确的 >如果最后一个对象不是图像,则以下 ...

  2. android+设置字体行高,android textview设置字体的行距和字间距

    android textview设置字体的行距和字间距 字间距 textView有一个属性android:textScaleX是调节字间距的,它的值是一个float型.查看源代码,默认textView ...

  3. android gridview固定行数据,如何在Android gridview中为行设置不同的列

    我有类似的东西,我解决与新的RecyclerView. 我创建了一个片段与一个RecyclerView. xml上的RecyclerView: android:id="@+id/filter ...

  4. Android成长日记-使用GridView显示多行数据

    本节将实现以下效果 Ps:看起来很不错的样子吧,而且很像九宫格/se ----------------------------------------------------------------- ...

  5. android gridview行分割线,Android使用GridView实现表格分割线效果

    使用gridview实现表格分割线效果,网格布局表格布局也是可以实现的. 效果如下: 1.主函数代码: package com.example.qd.douyinwu; import android. ...

  6. android gridview行分割线,Android中控件GridView实现设置行列分割线的方法示例

    前言 虽然Aandroid目前已经有RecyclerView了.非常强大的一个View.可以直接控制成ListView以及GridView等.而且画框线也比较方便.但是呢在很多情况下我们不得不仍然使用 ...

  7. 【Android 应用开发】 自定义组件 宽高适配方法, 手势监听器操作组件, 回调接口维护策略, 绘制方法分析 -- 基于 WheelView 组件分析自定义组件

    博客地址 : http://blog.csdn.net/shulianghan/article/details/41520569 代码下载 : -- GitHub : https://github.c ...

  8. androidsdktools安装_如何命令行安装Android SDK Build Tools(构建工具)?

    Android构建工具安装的问题 我想从命令行建立Android开发环境,遇到了如下问题: wget http://dl.google.com/android/android-sdk_r22.0.5- ...

  9. android drawableleft 垂直居中,Android TextView前加图标垂直居中第一行(仿大众点评购买须知/提示语)...

    如上图,需求在每条提示语句前加一个小圆点,我刚看到需求就想到用 android:drawableLeft 来作,可作完发现:当TextView内容为单行的时候是没有问题的,多行的时候,添加的这个dra ...

最新文章

  1. Python三十年技术演变史
  2. position:fixed和scroll实现div浮动【示例】
  3. zookeeper命令行(zkCli.shzkServer.sh)使用及四字命令
  4. 【BZOJ3672】[Noi2014]购票 树分治+斜率优化
  5. AVCaptureDevice 属性介绍
  6. 上海大华条码称代码_上海大华条码秤使用说明书
  7. 浩辰ICAD电气软件IDq2003i.rar
  8. excel粘贴时出现故障_你必将碰到的巨崩溃的问题,Excel复制粘贴时,突然提示“不同单元格格式太多“,我快疯了......
  9. 解决-redis保存的中文变为unicode, redis的基本操作
  10. c语言vc怎么改变背景板颜色,VC OnCtlColor函数来修改控件背景颜色
  11. linux学习记录(二)
  12. linux玩 LOL
  13. 程序员之路:护眼豆沙绿颜色值
  14. 破圈的《张朝阳的物理课》,开启“知识突围”的搜狐视频
  15. 如何梳理陌生的代码模块
  16. android 4.4 按键分析三
  17. Java非静态变量给静态变量赋值
  18. 如何从Excel表格导入数据批量生成二维码
  19. ChatGPT火了,对话式人工智能还能干嘛?
  20. 【强烈推荐】十三个鲜为人知的大数据学习网站

热门文章

  1. 在C/C++语言中使用正则表达式
  2. 树莓派python实例_使用Python实现树莓派WiFi断线自动重连实例(附代码)
  3. python自定义函数详解_Python自定义函数
  4. 常见linux网络参数
  5. Ubuntu9.10下安装Thinkpad T400 R29无线网卡
  6. Python defaultdict 模块和 namedtuple 模块 1
  7. IPv6系列(一)—快速入门
  8. Freeze 风暴导致的IOPS飙升 - 追溯与解法
  9. Vista中使用率最高的11条命令
  10. CentOS 7安装Nginx