2つの隣接するビューが必要です。1つは固定サイズで、もう1つは残りのスペースを使用する最初のビューに隣接しています。
ウェイトを使用してこれを簡単に行うことができますがLinearLayout、「ネストされたウェイトはパフォーマンスに悪い」という問題を回避したいと思います。
同等のことを実現できる別のレイアウトタイプはありますか?もしそうなら、例を提供してください。
2つの隣接するビューが必要です。1つは固定サイズで、もう1つは残りのスペースを使用する最初のビューに隣接しています。
ウェイトを使用してこれを簡単に行うことができますがLinearLayout、「ネストされたウェイトはパフォーマンスに悪い」という問題を回避したいと思います。
同等のことを実現できる別のレイアウトタイプはありますか?もしそうなら、例を提供してください。
RelativeLayoutたとえば、Aはあなたが望むことをすることができます:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
    <Button
        android:id="@+id/button1"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="Button"
        android:background="#99cc00" />
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@id/button1"
        android:text="Button" 
        android:background="#0077cc"/>
</RelativeLayout>
1つ目Buttonは幅200dpで、2つ目は親の残りの幅を埋めるために伸びます。
また、を使用しRelativeLayoutて2つのビューを同じサイズに分割し、一部のレイアウトで二重の重みが発生しないようにすることもできます。
これはRelativeLayoutで実行できると思います。例:
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <Button
        android:id="@+id/button"
        android:layout_width="100dp"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toRightOf="@id/button">
       ...
    </LinearLayout>
</RelativeLayout>
    あなたが試すことができます
    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >
    <Button
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:text="view with fixed size " />
    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="view with remaining space" />
</LinearLayout>
これは、LinearLayoutでの重みの仕組みです。
At first, it will deduct the fixed dimension, then according to the weight, divide the available space, assign to the views which specify the weight attribute