Hy!!
If i want to add a textview and a textedit, both are in the same line
I have a Linear Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:text="@+id/EditText01"
android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
What i have made wrong?
You need to add
android:orientation="vertical"to your LinearLayout. By default, it adds items horizontally.EDIT: Also, your
android:textattribute shouldn’t contain an@+id/, it defines what is displayed in the TextView. Only yourandroid:idattribute should have that.