Я хочу иметь EditText и кнопку в той же строке.
Так почему я положил <LinearLayout android:orientation="horizontal"...>
Но у меня также есть TextView, и я не хочу, чтобы TextView отображался в той же строке, что и EditText и кнопка.
Спасибо, что помогли мне.
Вы можете сделать это разными способами.
Использование линейного макета - вы можете поместить один линейный макет "A" сверху и установить его ориентацию "вертикально". Теперь вставьте в него два дочерних узла один новый линейный макет "B" и один текст. В новой линейной компоновке вы устанавливаете ориентацию "горизонтально", а затем добавляете в нее кнопку edittext.
Ниже приведен код:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:text="EditText"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:width="250dp"></EditText>
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
Попробуйте использовать RelativeLayout
в вашем xml.