Hi,
I am new to Android App Development and am having a bit of bother getting my screen layout the way I want it. I will do my best to explain the problem. I am doing a small app just to get used to Android Studio. I am following a tutorial to go through most of the features. I have inserted a TextView on the the screen firstly, in a root LinearLayout. I have then created an embedded LinearLayout with a button and an image. I will post the code below for this. In the tutorial it shows the TextView at the top of the screen and the Button and Image directly below it. My problem is that I can't move my Button and image(embedded LinearLayout) directly below. It has to be at the right hand side of the TextView.
The only way I can think on explaining a solution would be in Microsoft Word, no Text Wrapping allows you to drag the image anywhere on the page. Is there an option for something similar in Android Studio or am I missing something I should know? Any help would be appreciated. If I haven't explained in enough detail please let me know and I will do my best to correct.
This is the tutorial page(as a new member I can't post url):
www(dot)raywenderlich(dot)com/78576/android-tutorial-for-beginners-part-2
This is my code:
<LinearLayout (Cant post xml version url)
android:layout_width="wrap_content"
android:layout_height="500dp"
tools:context=".MainActivity"
android:orientation="horizontal"
android:id="@+id/">
<TextView android:id="@+id/main_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="@string/textview" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/">
<Button
android:id="@+id/main_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="@string/button" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
<!-- Displays keyboard when touched -->
<EditText
android:id="@+id/main_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_gravity="center_vertical"
android:hint="@string/hint" />
<!-- Set OnClickListener to trigger results when pressed -->
</LinearLayout>
I am new to Android App Development and am having a bit of bother getting my screen layout the way I want it. I will do my best to explain the problem. I am doing a small app just to get used to Android Studio. I am following a tutorial to go through most of the features. I have inserted a TextView on the the screen firstly, in a root LinearLayout. I have then created an embedded LinearLayout with a button and an image. I will post the code below for this. In the tutorial it shows the TextView at the top of the screen and the Button and Image directly below it. My problem is that I can't move my Button and image(embedded LinearLayout) directly below. It has to be at the right hand side of the TextView.
The only way I can think on explaining a solution would be in Microsoft Word, no Text Wrapping allows you to drag the image anywhere on the page. Is there an option for something similar in Android Studio or am I missing something I should know? Any help would be appreciated. If I haven't explained in enough detail please let me know and I will do my best to correct.
This is the tutorial page(as a new member I can't post url):
www(dot)raywenderlich(dot)com/78576/android-tutorial-for-beginners-part-2
This is my code:
<LinearLayout (Cant post xml version url)
android:layout_width="wrap_content"
android:layout_height="500dp"
tools:context=".MainActivity"
android:orientation="horizontal"
android:id="@+id/">
<TextView android:id="@+id/main_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="@string/textview" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/">
<Button
android:id="@+id/main_Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:text="@string/button" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
<!-- Displays keyboard when touched -->
<EditText
android:id="@+id/main_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_gravity="center_vertical"
android:hint="@string/hint" />
<!-- Set OnClickListener to trigger results when pressed -->
</LinearLayout>
Aucun commentaire:
Enregistrer un commentaire