title: Items in recyclerview setting layoutparams wrong
body: <p>I want in my notice app:
  Title exist, text dont exist = title should center vertically
  Text exist, title dont exist = text should center vertically</p>
  
  <p>My adapter looks like this:</p>
  
  <pre><code>public View view_title, view_text
  public ViewHolder(View v) {
          super(v);
          ...
          view_title = v.findViewById(R.id.title);
          view_text = v.findViewById(R.id.text);   
          title = (TextView) v.findViewById(R.id.title);
          text = (TextView) v.findViewById(R.id.text); 
          ...
  }
  @Override
  public void onBindViewHolder(final ViewHolder holder, final int position) {
  
      holder.title.setText(utilsM.getTitleByPos("tasks", position));
      holder.text.setText(utilsM.getNoticeByPos("tasks", position));
  
      if ( ( holder.title.getText().length() &gt; 0) &amp;&amp; (holder.text.getText().length() == 0) ) {
  
          holder.view_title.setVisibility(View.VISIBLE);
          holder.view_text.setVisibility(View.INVISIBLE);
  
          RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) holder.view_title.getLayoutParams();
          params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
  
          holder.view_title.setLayoutParams(params);
  
          debug("title: " + holder.title.getText());
          debug("text: " + holder.text.getText());
  
      } else if ( ( holder.text.getText().length() &gt; 0) &amp;&amp; (holder.title.getText().length() == 0) ) {
  
          holder.view_title.setVisibility(View.INVISIBLE);
          holder.view_text.setVisibility(View.VISIBLE);
  
          RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) holder.view_text.getLayoutParams();
          params2.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
          holder.view_text.setLayoutParams(params2);
      } else {
          holder.view_title.setVisibility(View.VISIBLE);
          holder.view_text.setVisibility(View.VISIBLE);
      }
  </code></pre>
  
  <p>I found out that i can set the "android:layout_centerVertical="true", in my code with:</p>
  
  <pre><code>        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) holder.view_title.getLayoutParams();
          params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
  
          holder.view_title.setLayoutParams(params);
  </code></pre>
  
  <p>All works fine.
  But sometimes do notices centering their title or text, although title and text both exist. How?</p>
  
  <p>It looks like this:
  <a href="https://i.stack.imgur.com/r2gTu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r2gTu.png" alt="enter image description here"></a></p>
  
  <p>Sorry for my bad english :D
  Any suggestions?</p>