Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically-generated LinearLayouts overlapping
    primarykey
    data
    text
    <p>I'm a newbie to Android development, and I'm very much still learning Java too so be gentle! </p> <p>I am creating an app that can take information about a task (I'm basing it around a sort of homework planner), store that info and then display it in a list. The program must be able to dynamically generate the list from the background files. I have managed all of this so far, but when I create a basic output for each task, containing the "subject" and "details" variables using a LinearLayout they appear on the screen overlapping. They all seem to be creating correctly, but they are all being put in the same place. Are there attributes I can set to make them display in a vertical list???</p> <p>Here is the piece of code where I generate the viewgroups and display them. This is called from a loop in another part of the program which finds the number of files in internal storage.</p> <pre><code> TextView subjView; TextView detailView; RelativeLayout displayLayout; LinearLayout taskDisplay = new LinearLayout(this); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); subjView = new TextView(this); detailView = new TextView(this); displayLayout = (RelativeLayout) findViewById(R.id.relative_display_layout); subjView.setText(subject); detailView.setText(details); layoutParams.setMargins(0, 0, 0, 0); taskDisplay.addView(subjView, layoutParams); layoutParams.setMargins(10, 0, 0, 0); taskDisplay.addView(detailView, layoutParams); displayLayout.addView(taskDisplay); </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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