2016-03-29 24 views
1

に関して幅を調整します。は、私はこのレイアウトを持っている別の要素

私はweightSumlayout_weightを使用できますが、別の方法はありませんか?あなたは、あなたがそれを簡単な方法を使用することができるのTextViewに長いテキストを持っている場合は事前に

おかげで

+1

はい、あなたは、画面サイズの計算とあなたのレイアウトサイズおよびあなたが計算し、レイアウトのあなたのサイズを調整する必要がありますする必要があり、そのすべてを実行時にこれを行うことができ、それはまた、サイズにあなたを固定するつもりされますWrap_contentを使用して必要な方法を調整できるようにする必要があります。 –

+0

なぜあなたは体重を使いたくないですか? :D – Vucko

答えて

3

はこの

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="60dp" 
    android:layout_alignParentBottom="true" 
    android:gravity="center" 
    android:orientation="horizontal" > 

    <TextView 
     android:id="@+id/yourtextview" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:text="@string/n_alb" /> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_toRightOf="@+id/yourtextview" > 
    </EditText> 
</RelativeLayout> 
+0

パーフェクト!ありがとうございました! –

0

を試してみてください。

<LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Android Development Android Development" 
      android:background="#fff000" 
      android:id="@+id/textView2" /> 

     <EditText 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/editText2" 
      android:singleLine="true" 
      android:text="hello developer How are you" 
      android:background="#ff0000" 
      /> 
    </LinearLayout> 
関連する問題