关于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可以多行输入,并且高度可以随着内容的增加而增加,但是当内容删减的时候 ...
随机推荐
- HDU1073:Online Judge
Problem Description Ignatius is building an Online Judge, now he has worked out all the problems exc ...
- Java-多重if 结构
import java.util.*;public class ifs { public static void main(String args[]){ Scanner in=new Scanner ...
- Ansible5:常用模块【转】
根据zs官方的分类,将模块按功能分类为:云模块.命令模块.数据库模块.文件模块.资产模块.消息模块.监控模块.网络模块.通知模块.包管理模块.源码控制模块.系统模块.单元模块.web设施模块.wind ...
- AVFoundation(二)---MPMusicPlayerController
话不多说,直接上代码,代码中详细介绍了如何初始化,并设置一些常用的属性. /** * MPMusicPlayerController用于播放音乐库中的音乐 */ /** * 初始化MPMusicPla ...
- asp.net如何删除文件夹及文件内容操作
static void DeleteDirectory(string dir) { && Directory.GetFiles(dir).Length == ) { Directory ...
- socket小解
要理解socket,首先得理解TCP/IP协议族, TCP/IP (Transmission Control Protocol/Internet Protocol)传输控制协议/网间协议 定义: TC ...
- shell 入门教程
打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好. 一 惯例,第一个shell #!/bin/bash echo "Hello ...
- How to Iterate Over a Map in Java?(如何遍历Map)
1.Iterate through the "entrySet" like so: public static void printMap(Map mp) { Iterator i ...
- 最小点集覆盖/HDU2119
题目连接 先试一下题/?/ 最小点集覆盖=最大匹配 /*根据i.j建图,跑一边最大匹配 */ #include<cstdio> #include<cstring> using ...
- JVM CPU打满问题定位
1.线程不释放,导致Old区占满,系统不停的FullGC 发现应用并没有在进行FGC,而是进行频繁的YGC. YGC也存在异常,S1和S0区域都是从0直接跳到99% 观察堆大小装太发现Young区内存 ...