Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that the problem is that you have not completely understood how to use layout_weight. And that you must keep better track of which family (parent and children) of views that are connected to different layout_weights in your design.</p> <p>I am not completely sure how things are supposed to work but I assume that you want the left menu to be visible all the time and then have more details displayed dynamically depending on what the user chooses. You also want the map to be partly visible all the time?</p> <p>Have thrown together some code that does the above. Play around with the code and you will probably be able to understand how it works. Let me know if you have problems understanding the code or if I have misunderstood what you want.</p> <p><strong>main.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:orientation="vertical" android:background="@android:color/white" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Menu" android:textColor="@android:color/black" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Show Details" android:onClick="showdetails" /&gt; &lt;/LinearLayout&gt; &lt;FrameLayout android:layout_width="0dip" android:layout_height="fill_parent" android:layout_weight="2.0" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/ic_launcher" /&gt; &lt;LinearLayout android:id="@+id/DetailsLinearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:visibility="gone" &gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1.0" android:text="Details" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@android:color/black" android:background="@android:color/white" /&gt; &lt;!-- This view is only here to prevent textView2 from completly covering the underlying picture --&gt; &lt;View android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1.0" /&gt; &lt;/LinearLayout&gt; &lt;/FrameLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>java</strong></p> <pre><code>package com.test.insertframelayoutinsideanotherframelayout; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; public class InsertframelayoutinsideanotherframelayoutActivity extends Activity { LinearLayout detailsLinearLayout; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); detailsLinearLayout = (LinearLayout) findViewById(R.id.DetailsLinearLayout); } public void showdetails(View v){ if (detailsLinearLayout.getVisibility() == View.GONE){ detailsLinearLayout.setVisibility(View.VISIBLE); } else { detailsLinearLayout.setVisibility(View.GONE); } } } </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.
    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