2013-10-11 3 views
0

У меня есть следующий макетAndroid: Получить EditText Посмотреть занять остальную часть экрана

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:text="Gross Pay" 
     /> 
    <EditText 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:hint="Gross Pay" 
     android:inputType="numberDecimal" 
     android:layout_weight="1" 
     /> 
</LinearLayout> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Continue" 
    /> 

</LinearLayout> 

Как вы можете видеть, что я попробовал все, что я могу думать, чтобы сделать EditText занять остальную часть экрана, однако, я все еще ничего не делаю. Он отлично выглядит в Eclipse, но когда я запускаю эмулятор, EditText не расширяется, как я ожидал.

Кто-нибудь может помочь

ответ

0

Dope! обнаружил, что это был фрагмент, и я должен был изменить ...

<fragment android:name="com.example.manageyobudget.fragment.GeneralTaxInformationFragment" 
     android:id="@+id/list" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" /> 

Для

<fragment android:name="com.example.manageyobudget.fragment.GeneralTaxInformationFragment" 
     android:id="@+id/list" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
+0

приятно слышать :) –

0

Попробуйте это .. если вы даете вес 1 означает, что вы должны дать 0dp, для которого вы хотите, чтобы соответствовать родителю ..

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:text="Gross Pay" 
     /> 
    <EditText 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:hint="Gross Pay" 
     android:inputType="numberDecimal" 
     android:layout_weight="1" 
     /> 
</LinearLayout> 
Смежные вопросы