I'm just starting out with Android development and am trying to learn the intricacies of everything. I'm trying to create a view that is something like $________
(a dollar sign followed by a text box), but I can't quite get the LinearLayout to work properly (I'm imagining it works just like XAML's StackPanel?).
Here's what I've got:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="75dp">
<TextView android:text="$"
android:textSize="65dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<EditText android:layout_width="150dp"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
But only the dollar sign shows up. If I switch it to be this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="75dp">
<EditText android:layout_width="150dp"
android:layout_height="match_parent"/>
<TextView android:text="$"
android:textSize="65dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
then it shows up like I would expect: _________$
, but the opposite doesn't seem to work well. Any help is greatly appreciated!
you can use
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:text="$"
android:textSize="65sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:textSize="65sp"
android:hint="Edit text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
And
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:textSize="65sp"
android:layout_width="wrap_content"
android:hint="Edit text"
android:layout_height="wrap_content"/>
<TextView android:text="$"
android:textSize="65sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>