zoukankan      html  css  js  c++  java
  • Android编程设置LayoutParams

     1         RelativeLayout.LayoutParams linearParams = (RelativeLayout.LayoutParams)viewHolder.headerWraper.getLayoutParams();
     2         RelativeLayout.LayoutParams textParams = (RelativeLayout.LayoutParams)viewHolder.textWrapper.getLayoutParams();
     3         
     4         linearParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); //清空alignParentRight参数
     5         textParams.addRule(RelativeLayout.ALIGN_LEFT, 0);           //清空toLeftOf参数
     6         
     7         if (fromToType == Constants.FromToType.FromToTypeFromThisUser.getValue()) { //根据条件设置Layout参数
     8 
     9             linearParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    10             textParams.addRule(RelativeLayout.LEFT_OF, R.id.header_wrapper);
    11             
    12             viewHolder.headerWraper.setLayoutParams(linearParams);
    13             viewHolder.textWrapper.setLayoutParams(textParams);
    14             
    15             Logger.d(TAG, "from this user");
    16         }
    17         else{
    18             Logger.d(TAG, "from otehr user");
    19             
    20             linearParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    21             textParams.addRule(RelativeLayout.RIGHT_OF , R.id.header_wrapper);
    22             
    23             viewHolder.headerWraper.setLayoutParams(linearParams);
    24             viewHolder.textWrapper.setLayoutParams(textParams);
    25             
    26             viewHolder.textWrapper.setBackgroundResource(R.drawable.chat_other);
    27         }
  • 相关阅读:
    python--Pandas(一)
    Orcale(一)
    三、显示博客信息
    二、Django需要的知识点
    一、Django初级
    mysql修改密码
    python更新mysql数据
    python查询mysql数据
    python与mysql的连接过程
    python如果想输出原格式的内容,可以加''' ''',占位符使用方式
  • 原文地址:https://www.cnblogs.com/sunshine-anycall/p/3562518.html
Copyright © 2011-2022 走看看