`
isiqi
  • 浏览: 15950598 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

实现ListView的条目下自动隐藏显示的布局

阅读更多

这个想法是我在看了sina微博的塞班客户端的微博显示效果而想移植到Android平台上,因为它的体验很好,而我们做的效果就是要方便,要用户有很好的体验,但是可惜的是在sina官方的Android客户端没有实现这种效果!

废话少说先贴图,看效果:

1。没有点击ListView之前


2。点击之后弹出四个Button




3。当点收起的时候又回到1的状态

当然这个只是刚做出来的效果,界面还没有具体的美化,所以看起来还勉强,呵呵!

追求完美,还需要很多的工作,废话少说,代码+讲解如下:

我之前从来没有做过这种的效果,出发点也不知道,跟大多数的人一样,沉思!

但是之后baidu+google,一遍不行再来,反复的找,但是也没找到解决的办法,目前还没有做这种的效果

莫得办法,自谋出路!ok

第一步:找高人博客(就看关于ListView的介绍)

我们看的不是别人怎么写出来的代码,看的是思想,人家是怎么考虑的,我看过的如下:

http://blog.csdn.net/flowingflying/archive/2011/03/28/6283942.aspx

http://blog.csdn.net/flowingflying/archive/2011/03/29/6286767.aspx

http://blog.csdn.net/flowingflying/archive/2011/03/31/6292017.aspx

这位对ListView的研究很深啊!上面三篇都是,逐步深入,对于初学者绝对是推荐

看了你就爱上他吧!总之一句话!我的神啊!哈哈哈

好了看到这儿,我想你的第一步就是因该马上收藏哥的这篇博客,赶紧看他的吧!他才是哥的灵感,然后再看我的blog

我想这才会理解,我为什么会这么做!ok!just do it!

下面是我看了后的感觉:吸取到的精华就是:

1.MVC模式:初学者不知者无罪,但是要知道M V C 三个代表什么,那部分代码因该是那部分的实现。

2.设计自己的ListView的关键是什么:我告诉你,是ListView和数据的桥梁Adapter,不管是什么BaseAdapter,SimpleAdapter一样,莫得区别了。

3.你需要知道Adapter的每个函数是怎么工作的,譬如说在调用getView之前你知道它会干什么吗?调用getCount?为什么会调用getCount呢?我说为什么不呢?因为偶去测试了,它就去先去调用了getCount,不会又神来告诉你了!需要你自己去do!不如你去试试吧,把它的返回值设为0,你放心你的getView不灵光了!呵呵

4.在Adapter中最重要的是什么?想想吧!告诉你是getView,然后它是怎么工作的?调用的机制是什么?怎么调用的?

它是一行行绘制,还是一下子搞完?ok?do it!

好了,还有许多就不一一列举,希望你看了这些也能获得这些知识,一个字悟道吧!就是这么出来的!不知道的可以交流,呵呵

第二步:编码

1.布局文件list.xml

List.xml代码 复制代码收藏代码
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="horizontal"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent"
  6. >
  7. <LinearLayout
  8. android:id="@+id/mainlayout"
  9. android:orientation="horizontal"
  10. android:layout_width="fill_parent"
  11. android:layout_height="wrap_content">
  12. <LinearLayout
  13. android:id="@+id/layout1"
  14. android:orientation="horizontal"
  15. android:layout_width="wrap_content"
  16. android:layout_height="wrap_content">
  17. <ImageView
  18. android:id="@+id/wbIcon"
  19. android:src="@drawable/sina"
  20. android:layout_width="50dip"
  21. android:layout_height="50dip"
  22. android:layout_marginLeft="5dip"
  23. android:layout_marginTop="5dip"
  24. android:layout_marginRight="5dip"
  25. android:adjustViewBounds="true">
  26. </ImageView>
  27. </LinearLayout>
  28. <LinearLayout
  29. android:id="@+id/layout2"
  30. android:orientation="vertical"
  31. android:layout_width="wrap_content"
  32. android:layout_height="wrap_content"
  33. android:layout_toRightOf="@+id/layout1"
  34. android:layout_alignParentRight="true">
  35. <RelativeLayout
  36. android:layout_width="wrap_content"
  37. android:layout_height="wrap_content"
  38. android:layout_alignParentRight="true">
  39. <TextView
  40. android:id="@+id/wbUser"
  41. android:text="username"
  42. android:textColor="#FF0000"
  43. android:textSize="15dip"
  44. android:layout_width="wrap_content"
  45. android:layout_height="wrap_content"
  46. android:paddingLeft="5dip">
  47. </TextView>
  48. <TextView
  49. android:id="@+id/wbTime"
  50. android:text="updatetime"
  51. android:textColor="#FF666666"
  52. android:textSize="14dip"
  53. android:layout_width="wrap_content"
  54. android:layout_height="wrap_content"
  55. android:paddingRight="5dip"
  56. android:layout_alignBottom="@+id/wbUser"
  57. android:layout_alignParentRight="true">
  58. </TextView>
  59. <TextView
  60. android:id="@+id/wbText"
  61. android:layout_height="wrap_content"
  62. android:layout_width="fill_parent"
  63. android:textSize="14dip"
  64. android:text="thecommentfillwithitiii\niiiiiiiiiiiiiijkkkkkkkkkkkkkkkkkkkkkkkkk"
  65. android:textColor="#424952"
  66. android:layout_below="@+id/wbUser"
  67. android:layout_alignParentLeft="true">
  68. </TextView>
  69. <LinearLayout
  70. android:orientation="vertical"
  71. android:layout_below="@+id/wbText"
  72. android:layout_width="fill_parent"
  73. android:layout_height="wrap_content">
  74. <TextView
  75. android:id="@+id/wbCommentText"
  76. android:layout_height="wrap_content"
  77. android:layout_width="fill_parent"
  78. android:textSize="14dip"
  79. android:textColor="#424952"
  80. android:background="#CDC9A5"
  81. android:text="uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu">
  82. </TextView>
  83. <ImageView
  84. android:id="@+id/wbImage"
  85. android:src="@drawable/sina"
  86. android:adjustViewBounds="true"
  87. android:layout_gravity="center_horizontal"
  88. android:layout_height="wrap_content"
  89. android:layout_width="wrap_content"
  90. android:layout_marginTop="3dip">
  91. </ImageView>
  92. </LinearLayout>
  93. </RelativeLayout>
  94. </LinearLayout>
  95. </LinearLayout>
  96. </RelativeLayout>

当然我这个布局做的不好,效率比较低,由于时间仓促没有修改,希望大家自己完成,代码优化是很重要的,原则就一个,尽量有少的layout实现该有的效果!

不知道发现没有:如果直接想的话,我们可能直接会说:那四个键直接写在List中嘛!当然我也试过,但是效果很差,而且一旦list条数过多就出现你都想吐的感觉!my god!怎么会这样!但是事实就是这样!不过你也可以尝试,只要去尝试总会成功的!相信自己,只不过我想到了一个更好的方法去做!效果更好而已!

我曾尝试过三个个方案

第一:折中方案,不在每个List的下面显示,而是都显示在最下面,但是可能会覆盖下面的菜单栏,故而舍弃,不过比上面简单的多,贴上xml

list.xml

Main.xml代码 复制代码收藏代码
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent"
  6. >
  7. <!--
  8. <LinearLayout
  9. android:id="@+id/buttonlayout"
  10. android:orientation="horizontal"
  11. android:paddingLeft="12dip"
  12. android:background="#EED8AE"
  13. android:layout_alignParentBottom="true"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. style="@android:style/ButtonBar">
  17. <Button
  18. android:id="@+id/wbTransmit"
  19. android:layout_width="wrap_content"
  20. android:layout_height="wrap_content"
  21. android:layout_weight="1"
  22. android:layout_alignParentBottom="true"
  23. android:visibility="gone"
  24. android:text="转发">
  25. </Button>
  26. <Button
  27. android:id="@+id/wbComment"
  28. android:layout_width="wrap_content"
  29. android:layout_height="wrap_content"
  30. android:layout_weight="1"
  31. android:layout_alignParentBottom="true"
  32. android:visibility="gone"
  33. android:text="评论">
  34. </Button>
  35. <Button
  36. android:id="@+id/wbRetract"
  37. android:layout_width="wrap_content"
  38. android:layout_height="wrap_content"
  39. android:layout_weight="1"
  40. android:layout_alignParentBottom="true"
  41. android:visibility="gone"
  42. android:text="收起">
  43. </Button>
  44. <Button
  45. android:id="@+id/wbWatchComment"
  46. android:layout_width="wrap_content"
  47. android:layout_height="wrap_content"
  48. android:layout_weight="1"
  49. android:layout_alignParentBottom="true"
  50. android:visibility="gone"
  51. android:text="看评论">
  52. </Button>
  53. </LinearLayout>
  54. -->
  55. <ListView
  56. android:id="@id/android:list"
  57. android:divider="#EEB422"
  58. android:dividerHeight="3dip"
  59. android:fadeScrollbars="true"
  60. android:fastScrollEnabled="true"
  61. android:background="@layout/list_corner"
  62. android:layout_width="fill_parent"
  63. android:layout_height="fill_parent">
  64. </ListView>
  65. </RelativeLayout>

注:在代码中的注释部分即是,他能够做出这种效果,但是在其中有许多的细节需要注意的,最外层需要RelativeLayout,其次list需要在Button之上,不能覆盖list,但是我做出来之后出现了一件诡异的事,list条目乱跳,很纠结。

方案二:直接将button放在list.xml中,作为list的一部分,并且隐藏,当点击list的时候显示list.xml如下:

list.xml

List.xml代码 复制代码收藏代码
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent">
  6. <LinearLayout
  7. android:id="@+id/layout01"
  8. android:layout_width="fill_parent"
  9. android:layout_height="wrap_content">
  10. <RelativeLayout
  11. android:id="@+id/relativelayout"
  12. android:orientation="vertical"
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:paddingLeft="12dip"
  16. android:paddingBottom="4dip"
  17. >
  18. <ImageView
  19. android:id="@+id/itemImage"
  20. android:layout_margin="5dip"
  21. android:src="@drawable/icon"
  22. android:layout_width="wrap_content"
  23. android:layout_height="wrap_content"/>
  24. <LinearLayout
  25. android:id="@+id/layout2"
  26. android:orientation="vertical"
  27. android:layout_toRightOf="@+id/itemImage"
  28. android:layout_width="wrap_content"
  29. android:layout_height="wrap_content">
  30. <TextView
  31. android:id="@+id/itemTitle"
  32. android:layout_width="fill_parent"
  33. android:layout_height="wrap_content"
  34. android:text="1111111111"
  35. android:textSize="20dip"/>
  36. <TextView
  37. android:id="@+id/itemText"
  38. android:layout_width="fill_parent"
  39. android:layout_height="wrap_content"
  40. android:text="2222222222"
  41. android:textSize="17dip"/>
  42. </LinearLayout>
  43. </RelativeLayout>
  44. </LinearLayout>
  45. <!--
  46. <RelativeLayout
  47. android:layout_below="@+id/layout01"
  48. android:orientation="vertical"
  49. android:paddingLeft="12dip"
  50. android:background="#EED8AE"
  51. android:layout_width="wrap_content"
  52. android:layout_height="wrap_content">
  53. <Button
  54. android:id="@+id/wbTransmit"
  55. android:focusable="false"
  56. android:focusableInTouchMode="false"
  57. android:clickable="false"
  58. android:layout_marginLeft="5dip"
  59. android:layout_width="wrap_content"
  60. android:layout_height="wrap_content"
  61. android:visibility="gone"
  62. android:text="转发">
  63. </Button>
  64. <Button
  65. android:id="@+id/wbComment"
  66. android:focusable="false"
  67. android:focusableInTouchMode="false"
  68. android:clickable="false"
  69. android:layout_width="wrap_content"
  70. android:layout_height="wrap_content"
  71. android:layout_marginLeft="28dip"
  72. android:layout_toRightOf="@+id/wbTransmit"
  73. android:layout_alignTop="@+id/wbTransmit"
  74. android:visibility="gone"
  75. android:text="评论">
  76. </Button>
  77. <Button
  78. android:id="@+id/wbRetract"
  79. android:focusable="false"
  80. android:focusableInTouchMode="false"
  81. android:clickable="false"
  82. android:layout_width="wrap_content"
  83. android:layout_height="wrap_content"
  84. android:layout_marginLeft="28dip"
  85. android:layout_toRightOf="@+id/wbComment"
  86. android:layout_alignTop="@+id/wbTransmit"
  87. android:visibility="gone"
  88. android:text="收起">
  89. </Button>
  90. <Button
  91. android:id="@+id/wbWatchComment"
  92. android:focusable="false"
  93. android:focusableInTouchMode="false"
  94. android:clickable="false"
  95. android:layout_width="wrap_content"
  96. android:layout_height="wrap_content"
  97. android:layout_alignParentRight="true"
  98. android:layout_alignTop="@+id/wbTransmit"
  99. android:visibility="gone"
  100. android:text="看评论">
  101. </Button>
  102. </RelativeLayout>
  103. -->
  104. </LinearLayout>

注:android:focusableInTouchMode="false" android:focusable="false" android:clickable="false"这三个是关键,一开始它是不显示的,

当点击list的时候显示,需要在点击事件中去做。但是结果是,点击后效果是出来了,但是每次四个button都出现在最后,而不是

list的下面,最后我分析,是由于getview,我们需要重写这个方法。其关键就是需要理解getView的工作机制。

第三步:重写BaseAdapter函数

这个是最关键的东西,代码如下:

BaseAdapter.java

Mybaseadapter代码 复制代码收藏代码
  1. packagecom.woclub.utils;
  2. importjava.util.List;
  3. importandroid.content.Context;
  4. importandroid.graphics.Color;
  5. importandroid.graphics.drawable.Drawable;
  6. importandroid.text.Spannable;
  7. importandroid.text.SpannableStringBuilder;
  8. importandroid.text.style.ForegroundColorSpan;
  9. importandroid.view.Gravity;
  10. importandroid.view.LayoutInflater;
  11. importandroid.view.View;
  12. importandroid.view.ViewGroup;
  13. importandroid.view.View.OnClickListener;
  14. importandroid.widget.BaseAdapter;
  15. importandroid.widget.Button;
  16. importandroid.widget.ImageView;
  17. importandroid.widget.LinearLayout;
  18. importandroid.widget.TextView;
  19. importcom.woclub.beans.WeiboHolder;
  20. importcom.woclub.beans.WeiboInfo;
  21. importcom.woclub.utils.AsyncImageLoader.ImageCallback;
  22. importcom.woclub.weibo.R;
  23. publicclassMyBaseAdapterextendsBaseAdapter{
  24. privateList<WeiboInfo>wbList;
  25. privateLayoutInflatermInflater;
  26. privateAsyncImageLoaderasyncImageLoader;
  27. privateContextmContext;
  28. privateWeiboHolderholder=null;
  29. privateintSelectListItem=0;
  30. publicMyBaseAdapter(Contextcontext,List<WeiboInfo>mData)
  31. {
  32. this.mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  33. this.wbList=mData;
  34. mContext=context;
  35. }
  36. //privateAsyncImageLoaderasyncImageLoader;
  37. @Override
  38. publicintgetCount(){
  39. //TODOAuto-generatedmethodstub
  40. returnwbList.size();
  41. }
  42. @Override
  43. publicObjectgetItem(intposition){
  44. //TODOAuto-generatedmethodstub
  45. returnwbList.get(position);
  46. }
  47. @Override
  48. publiclonggetItemId(intposition){
  49. //TODOAuto-generatedmethodstub
  50. returnposition;
  51. }
  52. @Override
  53. publicViewgetView(intposition,ViewconvertView,ViewGroupparent){
  54. //TODOAuto-generatedmethodstub
  55. if(position<0||wbList.size()<=0)
  56. returnnull;
  57. Viewrow=convertView;
  58. LinearLayoutlayout=newLinearLayout(mContext);
  59. layout.setOrientation(LinearLayout.VERTICAL);
  60. if(convertView==null)
  61. {
  62. //一行行的加载list
  63. layout.addView(addListView(position,row));
  64. }
  65. else
  66. {
  67. holder=(WeiboHolder)row.getTag();
  68. //这是增加四个Button控件
  69. layout.addView(addListView(position,row));
  70. intID=this.getSelectListItem();
  71. //如果选择的行是当前正重新刷新(即当前载入的行)时,我们在下面加入四个button
  72. if(ID==position){
  73. layout.addView(addButtonView());
  74. }
  75. }
  76. returnlayout;
  77. }
  78. /**
  79. *设置text中显示的格式
  80. *@paramwbTextTextView
  81. *@paramstring开始的字符
  82. *@paramstring2结束字符
  83. */
  84. privatevoidtextHighlight(TextViewtextView,Stringstart,Stringend){
  85. Spannablesp=(Spannable)textView.getText();
  86. Stringtext=textView.getText().toString();
  87. intn=0;
  88. ints=-1;
  89. inte=-1;
  90. while(n<text.length()){
  91. s=text.indexOf(start,n);
  92. if(s!=-1){
  93. e=text.indexOf(end,s+start.length());
  94. if(e!=-1){
  95. e=e+end.length();
  96. }else{
  97. e=text.length();
  98. }
  99. n=e;
  100. sp.setSpan(newForegroundColorSpan(Color.BLUE),s,e,
  101. Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  102. s=e=-1;
  103. }else{
  104. n=text.length();
  105. }
  106. }
  107. }
  108. publicvoidsetSelectListItem(intposition)
  109. {
  110. this.SelectListItem=position;
  111. }
  112. publicintgetSelectListItem()
  113. {
  114. returnthis.SelectListItem;
  115. }
  116. /**
  117. *这个函数的作用是加载整个List列表
  118. *是一行行的加载整个list
  119. *@paramposition行list的位置
  120. *@return
  121. */
  122. privateViewaddListView(intposition,Viewrow)
  123. {
  124. asyncImageLoader=newAsyncImageLoader();
  125. row=mInflater.inflate(R.layout.list,null);
  126. //先取的控件
  127. holder=newWeiboHolder();
  128. //下面是获取xml中的实例化控件对象
  129. holder.wbIcon=(ImageView)row.findViewById(R.id.wbIcon);
  130. holder.wbUser=(TextView)row.findViewById(R.id.wbUser);
  131. holder.wbTime=(TextView)row.findViewById(R.id.wbTime);
  132. holder.wbText=(TextView)row.findViewById(R.id.wbText);
  133. holder.wbCommentText=(TextView)row.findViewById(R.id.wbCommentText);
  134. holder.wbImage=(ImageView)row.findViewById(R.id.wbImage);
  135. //Setsthetagassociatedwiththisview.这个tags是包含了view里面的控件,但不一定是唯一的
  136. //即相当于这个view重新获得了一个完整的实例化控件集合(实例由上面四步完成)
  137. WeiboInfowb=wbList.get(position);
  138. if(wb!=null)
  139. {
  140. row.setTag(wb.getId());
  141. holder.wbUser.setText(wb.getUserName());
  142. holder.wbTime.setText(wb.getTime());
  143. //vw.setText("Italic,highlighted,bold.",TextView.BufferType.SPANNABLE);
  144. //toforceittouseSpannablestoragesostylescanbeattached.
  145. //OrwecouldspecifythatintheXML.
  146. holder.wbText.setText(wb.getText(),TextView.BufferType.SPANNABLE);
  147. //设置微博内容的显示格式
  148. textHighlight(holder.wbText,"#","#");
  149. textHighlight(holder.wbText,"@",":");
  150. textHighlight(holder.wbText,"http://","");
  151. holder.wbCommentText.setText(wb.getCommentText(),TextView.BufferType.SPANNABLE);
  152. textHighlight(holder.wbCommentText,"#","#");
  153. textHighlight(holder.wbCommentText,"@",":");
  154. //textHighlight2(holder.wbCommentText,newchar[]{'#'},newchar[]{'#'});
  155. //textHighlight2(holder.wbCommentText,newchar[]{'@'},newchar[]{':',''});
  156. //载入头像
  157. DrawablecachedIcon=asyncImageLoader.loadDrawable(wb.getUserIcon(),holder.wbIcon,newImageCallback(){
  158. @Override
  159. publicvoidimageLoaded(DrawableimageDrawable,ImageViewimageView,
  160. StringimageUrl){
  161. //TODOAuto-generatedmethodstub
  162. imageView.setImageDrawable(imageDrawable);
  163. }
  164. });
  165. if(cachedIcon==null)
  166. {
  167. holder.wbIcon.setImageResource(R.drawable.sina);
  168. }
  169. else
  170. {
  171. holder.wbIcon.setImageDrawable(cachedIcon);
  172. }
  173. //载入图片
  174. if(wb.getImage()!=null)
  175. {
  176. DrawablecachedImage=asyncImageLoader.loadDrawable(wb.getImage(),holder.wbImage,newImageCallback(){
  177. @Override
  178. publicvoidimageLoaded(DrawableimageDrawable,ImageViewimageView,
  179. StringimageUrl){
  180. //TODOAuto-generatedmethodstub
  181. imageView.setImageDrawable(imageDrawable);
  182. }
  183. });
  184. if(cachedImage==null)
  185. {
  186. holder.wbImage.setImageResource(R.drawable.sina);
  187. }
  188. else
  189. {
  190. holder.wbImage.setImageDrawable(cachedImage);
  191. }
  192. }
  193. }
  194. row.setTag(holder);
  195. returnrow;
  196. }
  197. /*
  198. *这个函数的作用是显示List下面的四个Button
  199. */
  200. privateViewaddButtonView()
  201. {
  202. //流式布局放四个button
  203. LinearLayoutlayout=newLinearLayout(mContext);
  204. layout.setOrientation(LinearLayout.HORIZONTAL);
  205. layout.setPadding(12,1,12,1);
  206. layout.setBackgroundColor(android.R.color.darker_gray);
  207. layout.setGravity(Gravity.CENTER);
  208. finalButtonbt1=newButton(mContext);
  209. bt1.setText("转发");
  210. bt1.setFocusable(false);
  211. bt1.setFocusableInTouchMode(false);
  212. bt1.setClickable(true);
  213. bt1.setOnClickListener(newOnClickListener(){
  214. @Override
  215. publicvoidonClick(Viewv){
  216. //TODOAuto-generatedmethodstub
  217. System.out.println("wbTransmit");
  218. }
  219. });
  220. layout.addView(bt1,
  221. newLinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  222. finalButtonbt2=newButton(mContext);
  223. bt2.setText("评论");
  224. bt2.setFocusable(false);
  225. bt2.setFocusableInTouchMode(false);
  226. bt2.setClickable(true);
  227. bt2.setOnClickListener(newOnClickListener(){
  228. @Override
  229. publicvoidonClick(Viewv){
  230. //TODOAuto-generatedmethodstub
  231. System.out.println("wbComment");
  232. }
  233. });
  234. layout.addView(bt2,
  235. newLinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  236. finalButtonbt3=newButton(mContext);
  237. bt3.setText("看评论");
  238. bt3.setFocusable(false);
  239. bt3.setFocusableInTouchMode(false);
  240. bt3.setClickable(true);
  241. bt3.setOnClickListener(newOnClickListener(){
  242. @Override
  243. publicvoidonClick(Viewv){
  244. //TODOAuto-generatedmethodstub
  245. System.out.println("wbWatchComment");
  246. }
  247. });
  248. layout.addView(bt3,
  249. newLinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  250. finalButtonbt4=newButton(mContext);
  251. bt4.setText("收起");
  252. bt4.setFocusable(false);
  253. bt4.setFocusableInTouchMode(false);
  254. bt4.setClickable(true);
  255. bt4.setOnClickListener(newOnClickListener(){
  256. @Override
  257. publicvoidonClick(Viewv){
  258. //TODOAuto-generatedmethodstub
  259. 分享到:
    评论
    1 楼 duduli 2011-11-05  
    有没有方法,控制list.xml的单个控件隐藏。

相关推荐

    C#开发实例大全(基础卷).软件开发技术联盟(带详细书签) PDF 下载

    实例206 从桌面右下角显示的Popup窗口提醒 276 实例207 设置可执行文件的生成图标 278 第10章 MDI窗体和继承窗体 279 10.1 MDI窗体的使用 280 实例208 设置窗体为父窗体 280 实例209 使子窗体最大化显示 281 实例210...

    C#编程经验技巧宝典

    2 &lt;br&gt;0003 设置程序代码行序号 3 &lt;br&gt;0004 开发环境全屏显示 3 &lt;br&gt;0005 设置窗口的自动隐藏功能 3 &lt;br&gt;0006 根据需要创建所需解决方案 4 &lt;br&gt;0007 如何使用“验证的目标架构”功能 4 ...

    vfp6.0系统免费下载

    vf6.0,要考二级没系统的下哈 Microsoft Visual FoxPro 6.0 for Windows 的常见问题 这些是有关 Microsoft Visual FoxPro 最常见的问题。在您求助 Microsoft 产品支持服务之前,请先查阅这张列表。 若想打印这些...

    ASP.NET 控件的使用

    1.3.3 使用代码隐藏页面 24 1.3.4 处理页面事件 27 1.3.5 使用Page.IsPostBack属性 29 1.3.6 调试和跟踪ASP.NET页面 30 1.3.7 跟踪页面执行 33 1.4 安装ASP.NET Framework 35 1.5 小结 37 第2章 使用标准控件 38 ...

    ASP.NET.4揭秘

    1.3.3 使用代码隐藏页面27 1.3.4 处理页面事件30 1.3.5 使用page.ispostback属性32 1.3.6 调试和跟踪asp.net页面33 1.3.7 跟踪页面执行36 1.4 安装asp.net38 .1.5 小结40 第2章 使用标准控件41 2.1 显示信息41 2.1.1...

    WPF编程宝典 part1

    2.2.2 代码隐藏类 22 2.3 XAML中的属性和事件 24 2.3.1 简单属性与类型转换器 25 2.3.2 复杂属性 26 2.3.3 标记扩展 28 2.3.4 附加属性 29 2.3.5 嵌套元素 30 2.3.6 特殊字符与空白 32 2.3.7 事件 34 2.3.8 完整的...

    WPF编程宝典 part2

    2.2.2 代码隐藏类 22 2.3 XAML中的属性和事件 24 2.3.1 简单属性与类型转换器 25 2.3.2 复杂属性 26 2.3.3 标记扩展 28 2.3.4 附加属性 29 2.3.5 嵌套元素 30 2.3.6 特殊字符与空白 32 2.3.7 事件 34 2.3.8 完整的...

Global site tag (gtag.js) - Google Analytics