Я думаю, что проблема в том, что вы не совсем поняли, как использовать layout_weight. И вы должны лучше отслеживать, какая семья (родительская и дочерняя) представлений связана с различными layout_weights в вашем дизайне.
Я не совсем уверен, как все должно работать, но я предполагаю, что вы хотите, чтобы левое меню постоянно отображалось, а затем динамически отображало больше деталей в зависимости от того, что выберет пользователь. Вы также хотите, чтобы карта была частично видна постоянно?
Собрали некоторый код, который делает выше. Поиграйте с кодом, и вы, вероятно, сможете понять, как он работает. Дайте мне знать, если у вас возникли проблемы с пониманием кода или я неправильно понял, что вы хотите.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:orientation="vertical"
android:background="@android:color/white"
>
<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" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Show Details"
android:onClick="showdetails" />
</LinearLayout>
<FrameLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="2.0"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/ic_launcher" />
<LinearLayout
android:id="@+id/DetailsLinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
>
<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" />
<!-- This view is only here to prevent textView2 from completly
covering the underlying picture -->
<View
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1.0" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
Java
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);
}
}
}