Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand correctly, I think your issue is only that you are declaring and then changing the <code>layoutParams</code> margins which sets them both to the same, which is overlapping your <code>TextViews</code>.</p> <hr> <p><strong>Edit</strong></p> <p>Okay, I am still not 100% sure how you are doing all of this so my example may need to be tweaked. I tried to throw this together quickly so forgive me for any minor mistakes.</p> <p>New mock up for dynamic layouts:</p> <pre><code>TextView subjView, detailView; RelativeLayout displayLayout, rl; // I am assuming this is your main layout displayLayout = (RelativeLayout) findViewById(R.id.relative_display_layout); // Just using a for loop as an example of a loop event, not sure how you are accomplishing this for(int i = 0; i &lt; data.length(); i++) { RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, 100); if (i &gt; 0) { int rePositionRule = i; rllp.addRule(RelativeLayout.BELOW, rePositionRule); } RelativeLayout taskDisplay = new RelativeLayout(this); taskDisplay.setLayoutParams(rllp); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(0, 0, 0, 0); LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); layoutParams2.setMargins(10, 0, 0, 0); subjView = new TextView(this); detailView = new TextView(this); subjView.setText(subject); subjView.setLayoutParams(layoutParams); detailView.setText(details); detailView.setLayoutParams(layoutParams2); taskDisplay.addView(subjView); taskDisplay.addView(detailView); displayLayout.addView(taskDisplay); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload