Is index important in addView()?
来源:互联网 发布:java格式化日期 编辑:程序博客网 时间:2024/06/06 14:18
http://stackoverflow.com/questions/21578170/is-index-important-in-addview
Is index important in addView()?
I can't understand the function of index
in addView(View child, int index)
of aViewGroup
.What's the index
for? Can be index
negative value? Does it affect to thelayout
or the way to display the view
?I have tested the code with and withoutindex
and I can't see the difference.
1 Answer
The point of the index attribute is to allow you change the order of views.
Let's say you have a massive list of views, and want to suddenly put one at the very top. If you specify that view's index as 0, it will be the first to display in the layout.
The Android documentation talks briefly about this.
A previous SO question shows the practical use for this: Android: How to add view at start of layout?.
Unless you really need to specify a position for the view, just use addView(view)
.
- Is index important in addView()?
- what is the most important in life
- addView(View,index) 用法
- addView(View, LayoutParams) is not supported in AdapterView异常
- addView(View, LayoutParams) is not supported in AdapterView
- [Android界面] addView(View, LayoutParams) is not supported in AdapterView
- Android开发:UnsupportedOperationException: addView(View, LayoutParams) is not supported in ...
- UnsupportedOperationException: addView(View, LayoutParams) is not supported in ...
- addView(View, LayoutParams) is not supported in AdapterView
- What is the most important thing in your life?
- what is the important things in my life?
- java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- Android开发:UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- ListView adapter getView 报错: addView(View, LayoutParams) is not supported in AdapterView
- java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- Index.ANALYZED in lucene4 is deprecated
- NSString 以UTF8f进行url编码 和 解码
- ConcurrentHashMap解析
- 加密算法之BLOWFISH算法
- OV5640 sensor 偏绿调试记录
- STM32F429DISCO+AT070TN92 7寸LCD
- Is index important in addView()?
- 【官方博客】Android’s HTTP Clients
- OC基础——代理模式(delegate)
- SSH Server And “Permission denied (publickey) git
- Acronym 计算机领域常用缩写
- 【练习题】螺旋队列问题
- linux 内核框架
- MySql的Query和Insert性能测试
- 【移动开发】Activity的四种启动模式详解