关于flex4 list 高度适应内容
Flex 4: Setting Spark List height to its content height
How to set a Spark List height to the height of its content?
Tried this:
var lastRow:IVisualElement =
myList.dataGroup.getElementAt(myList.dataGroup.numElements - 1);
myList.height = lastRow.y + lastRow.height;
It works in case of a single item, but lastRow is null in case of more items.
asked Apr 1 '10 at 9:34
2,83832553
5 Answers
In mxml you can do it like so:
<s:List width="100%">
<s:layout>
<s:VerticalLayout useVirtualLayout="false" requestedMinRowCount="1"/>
</s:layout>
</s:List>
You set the requestedMinRowCount or the requestedRowCount in the layout inside the List. It got me before, too. Hope that helps.
answered Sep 29 '10 at 22:17
21633
I'm trying to get this to work with TileLayout, but there is no requestedMinRowCount for TileLayout. I wonder how to get the height to dynamically set for the list when using TileLayout so that the list only takes up space for which it needs to display it's rows? – Stephen Horvath Aug 30 '11 at 18:03
For TileList I did it like this:
<s:List width="100%" height="{(tilelayout.rowCount * tilelayout.rowHeight) + ((tilelayout.rowCount - 1) * tilelayout.verticalGap)}">
<s:layout>
<s:TileLayout id="tilelayout" rowHeight="190" columnWidth="130" horizontalGap="5" verticalGap="10" />
</s:layout>
</s:List>
answered Aug 30 '11 at 18:14
1138
try this layout - for regular list
<s:layout>
<s:VerticalLayout horizontalAlign="contentJustify"
gap="0"
verticalAlign="middle"
variableRowHeight="false"/>
</s:layout>
answered Nov 22 '11 at 11:35
211
public class MyTileLayout extends TileLayout
{
override public function updateDisplayList(w:Number, h:Number):void
{
super.updateDisplayList(w,h);
target.height = rowCount*rowHeight + verticalGap*(rowCount - 1);
}
}
Or you can extend your TileLayout :)
answered Nov 4 '11 at 15:08
1
Easiest way to do this
height="{list.dataGroup.contentHeight}"
关于flex4 list 高度适应内容的更多相关文章
- 实现textarea高度自适应内容,无滚动条
最近接触到一个很好用的js插件,可以实现textarea高度随内容增多而改变,并且不显示滚动条,推荐给大家: http://www.jacklmoore.com/autosize/
- iframe高度自适应内容
JS自适应高度,其实就是设置iframe的高度,使其等于内嵌网页的高度,从而看不出来滚动条和嵌套痕迹.对于用户体验和网站美观起着重要作用. 如果内容是固定的,那么我们可以通过CSS来给它直接定义一个高 ...
- Textarea高度随内容自适应地增长,无滚动条
<HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; char ...
- 限制div高度当内容多了溢出时显示滚动条
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type"content= ...
- textarea高度随内容自适应
最近遇到一个需求,视频名称初始有个生成值,并且支持可以手动修改,修改后名称过长后换行高度随内容增加.刚开始想到用input但是发现input不支持换行.后来用了textarea,用js来控制,下面是实 ...
- textarea的高度随内容变化而变化
<li class="text"> <span>参赛宣言*</span> <textarea name="txt" i ...
- 如何使tinymce编辑器的高度随内容自变化(转载)
如何使tinymce编辑器的高度随内容自变化 最简单的方法就是在配置时添加Autoresize插件: tinymce.init({ selector: "textarea", // ...
- textarea文本域的高度随内容的变化而变化
用css控制textarea文本域的高度随内容的变化而变化,不出现滚动条. CSS代码: 复制代码 代码如下: .t_area{ width:300px; overflow-y:visible } & ...
- textarea高度随着内容的多少而变化,高度可以删减
问题:可以多行输入,并且输入框的高度随着内容的多少而变化,输入框的高度不能只增不减 由于 input 只能单行输入 textarea可以多行输入,并且高度可以随着内容的增加而增加,但是当内容删减的时候 ...
随机推荐
- hdu_3067_小t的游戏(脑洞)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3067 题意:中文,不解释 题解:一看就知道是要找规律的题,都是有循环节的,看代码. #include ...
- IoC容器Autofac正篇之类型注册(五)
Autofac类型注册 类型注册简单的从字面去理解就可以了,不必复杂化,只是注册的手段比较丰富. (一)类型/泛型注册 builder.RegisterType<Class1>(); 这种 ...
- Java良葛格 学习笔记《二》
正则表达式 . 符合任一字符\d 符合0到9任一个数字字符\D 符合0-9以外的字符\s 符合'\t'.'\n'.'\x0B'.'\f'.'\r'等空格符\w 符合a到z.A到Z.0到9等字符,也就是 ...
- IBM Mq Spring JMS 的xml配置
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...
- MyEclipse的Expressions没有结果的解决办法
之前我的Expressions在Value这一列什么都不显示,就连简单的1+2结果3都不显示出来. 然后我咬咬牙把它卸载了,然后重装就好了,我也不清楚是什么原因. 1.之前我安装的目录是"C ...
- vs找不到svn源代码管理插件之我见
使用svn要安装两个文件,一个客户端:TortoiseSVN-1.8.msi,一个插件:AnkhSvn-2.5.msi:两个都安装好之后,在vs的tool(工具)选项卡中,选择自定义,然后选择sour ...
- laravel路由使用【总结】
1.路由参数 必选参数 有时我们需要在路由中捕获 URI 片段.比如,要从 URL 中捕获用户 ID,需要通过如下方式定义路由参数: Route::get('/test_param/{id}', 'T ...
- jquery 高亮
<ul> <li id="0">冬瓜很好吃</li> <li id="1">西瓜不好吃</li> & ...
- regress
#! /bin/ksh ############### ### UAT ### ############### export ENVS=/test/change/env/env_test.sq ...
- HTML+CSS D08浮动
1. <html> <head> <title>div浮动</title> <style type="text/css"> ...