Родительский линейный макет не занимает весь экран, несмотря на наличие fill_parent - PullRequest
0 голосов
/ 15 марта 2012

У меня сейчас странная проблема с родительским линейным макетом, его высота установлена ​​на fill_parent, но вместо этого он намеревается обернуть содержимое, что меня действительно удивляет еще больше, так как в графическом представлении макета он отображается как я собираюсь его посмотреть, но все же он не делает то, что должен в эмуляторе?

вот мой код:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark_transparent" >

<LinearLayout

    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical"
    >

    <LinearLayout

        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center_vertical|center_horizontal|center"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="5dp"
        android:orientation="vertical"
        android:paddingTop="5dp" >


        <EditText
            android:id="@+id/menutweetedittext"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_text"
            android:gravity="top"
            android:hint="@string/edittext_hint"
            android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
            android:lines="4"
            android:textAppearance="@style/TextAppearance.EditText" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:gravity="right"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/menucharactersremaining"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/characters"
                android:textColor="#FFFFFF"
                android:textSize="20dp" />

            <Button
                android:id="@+id/menuposttweetbutton"
                style="@style/TextAppearance.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:background="@drawable/button_background"
                android:onClick="posttweetbuttonClicked"
                android:text="@string/postbuttonstext"
                android:textSize="15dp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="8dp"
            android:orientation="vertical" >
        </LinearLayout>
    </LinearLayout>

    <com.google.ads.AdView
        android:id="@+id/menuadView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="a14f5be094d0328"
        ads:loadAdOnCreate="true" />
</LinearLayout>

1 Ответ

0 голосов
/ 16 марта 2012

Я сделал попытку упростить ваш макет.Я отбросил весь твой стиль, но, возможно, объекты находятся в нужных местахЭто то, что вы ищете?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray" >

<EditText
    android:id="@+id/menutweetedittext"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:gravity="top"
    android:hint="Hint"
    android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
    android:lines="4"
    android:textAppearance="@android:style/TextAppearance.Medium" />

<Button
    android:id="@+id/menuposttweetbutton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/menutweetedittext"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="8dp"
    android:onClick="posttweetbuttonClicked"
    android:text="Tweet"
    android:textSize="15dp" />

<TextView
    android:id="@+id/menucharactersremaining"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/menuposttweetbutton"
    android:layout_toLeftOf="@+id/menuposttweetbutton"
    android:text="This is the text view"
    android:textColor="#FFFFFF"
    android:textSize="20dp" />

<ImageView
    android:id="@+id/menuadView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:background="@android:color/white"
    android:src="@drawable/icon" />
</RelativeLayout>
...