Кнопка «Отправить» выстроена неправильно - PullRequest
0 голосов
/ 20 декабря 2011

Я поместил свой xml-код в представление прокрутки, так как у меня было больше информации о нем, чем о недвижимости, и моя кнопка «Отправить» теперь опирается на вышеупомянутый editText2, и я не могу его получить.Кнопка установлена ​​ниже секции edittext2, но она явно там не идет.

Спасибо

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >

<RelativeLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="@string/sleeping_tracking"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <DatePicker
        android:id="@+id/datePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="16dp" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/datePicker1"
        android:layout_marginTop="50dp"
        android:text="@string/start_date"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TimePicker
        android:id="@+id/timePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/datePicker1"
        android:layout_below="@+id/datePicker1" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/timePicker1"
        android:layout_marginTop="48dp"
        android:text="@string/start_time"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <DatePicker
        android:id="@+id/datePicker2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/timePicker1" />

    <TimePicker
        android:id="@+id/timePicker2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/datePicker2"
        android:layout_below="@+id/datePicker2" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/datePicker2"
        android:layout_marginTop="49dp"
        android:text="@string/end_date"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/timePicker2"
        android:layout_below="@+id/timePicker2" >

        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="@string/nap" />

        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/nights_sleep" />
    </RadioGroup>

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/radioGroup1"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="33dp"
        android:text="@string/sleep"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignTop="@+id/timePicker2"
        android:layout_marginTop="49dp"
        android:text="@string/end_time"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView6"
        android:layout_marginTop="30dp"
        android:text="@string/wakeups"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/textView7"
        android:layout_alignLeft="@+id/radioGroup1"
        android:layout_alignRight="@+id/textView1"
        android:inputType="number" >

        <requestFocus />
    </EditText>

    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView7"
        android:layout_marginTop="32dp"
        android:text="@string/comment"
        android:textAppearance="?android:attr/textAppearanceLarge" />



    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView8"
        android:layout_alignBottom="@+id/textView8"
        android:layout_alignLeft="@+id/editText1"
        android:layout_alignParentRight="true"
        android:inputType="textMultiLine" />


    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText2"
        android:layout_centerHorizontal="true"
        android:text="@string/Add" />

</RelativeLayout>
</ScrollView>

Ответы [ 2 ]

0 голосов
/ 20 декабря 2011

г. Intelwalk Я проверил код разметки XML, который вы разместили, он работает нормально. Кнопка отображалась только под edittext2. Как вы получили выше edittxt2. если вы заинтересованы, пожалуйста, оставьте снимок здесь.

В моем выводе кнопка находится в следующей строке edittext2, означает полностью на связи и ниже edittext2. Если нам нужен разрыв, мы должны использовать верхнее поле.

Надеюсь, это поможет вам.

0 голосов
/ 20 декабря 2011

Я добавил

android:layout_marginTop="20dp"

и он опустился, но я не мог понять, почему он отображался поверх текста редактирования

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...