Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Each element can have exactly one parent, that's an XML file structure.</p> <p>In your layout xml file you defined <code>layoutTopicGrade</code> as the child of <code>layoutFilterContent</code>. Then, in the code, you set <code>layoutTopicGrade</code> as the child of the newly created <code>ScrollView</code>.</p> <p>You should wrap your <code>layoutTopicGrade</code> the <code>ScrollView</code>. Also, since you're not doing any dynamic configuration to the <code>ScrollView</code>, there's no reason adding it in the code, you should do it straight in the layout xml file:</p> <pre><code>&lt;ScrollView android:id="@+id/scrollViewTopicGrade" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@android:color/transparent" &gt; &lt;LinearLayout android:id="@+id/layoutTopicGrade" android:orientation="vertical" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:padding="0dp" android:background="#BCC6CC" &gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; </code></pre> <hr> <p><strong>EDIT</strong></p> <p>In order to have <code>layoutTopicGrade</code> take 25% of parent's width and <code>layoutGames</code> take 75%, do the following:</p> <ol> <li>Move the <code>layout_weight</code> and <code>layout_width</code> from <code>layoutTopicGrade</code> to the <code>ScrollView</code>.</li> <li>Set <code>ScrollView</code>'s <code>layout_weight</code> to <code>.25</code>.</li> <li>Set <code>layoutGames</code>'s <code>layout_weight</code> to <code>.75</code>.</li> <li><code>layoutTopicGrade</code>'s children should have <code>layout_width</code> set to <code>fill_parent</code>.</li> </ol> <p>See <a href="https://stackoverflow.com/a/6557686/978502">this answer</a>.</p> <hr> <p><strong>ADDITION</strong></p> <p>BTW, looks like the line <code>this.setContentView(scroll);</code> should be deleted. <code>Activity.setContentView</code> is used to set a view for the whole activity = whole screen. But your <code>ScrolView</code> is apparently only for the topic layout. Rather the whole game board is the activity's content view, as you use it a few lines of code earlier: <code>setContentView(R.layout.game_board);</code> (so keep that one).</p>
 

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