Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll make a quick explanation for you at your level of understanding. You will want to follow the tutorial Houcine gave you, but to answer your question best I can:</p> <p>First off: A form is a field that users input information into. Like a textbox, or a checkbox. You CAN put multiple forms on a single page. For example:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="CheckBox" /&gt; &lt;RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RadioButton" /&gt; &lt;Spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; </code></pre> <p></p> <p>See, all sorts of forms!</p> <p>But I think what you mean to ask is, how do I link to different layouts.</p> <p>The answer to your second question is: Yes! Simply make a new xml file in your res>layout folder! Toss a <code>&lt;?xml version="1.0" encoding="utf-8"?&gt;</code> at the top then have fun!</p> <p>If you want to link to that new layout, make a button or something in main.xml. in the .xml file of that button, add <code>android:onClick="doThis"</code> (or whatever you want in the quotations) to the button.</p> <p>Now, make your second page (a new class) in the same directory as your main.java. Call it whatever you want. I'm going to call it Page2Activity.java.</p> <p>Now, to switch between layouts easily as a beginner, I found this is the easiest way: Lets say our second page was page2.xml, add this piece of code into your main activity's java file.</p> <pre><code> public void doThis(View view) { Intent page2 = new Intent(); page2.setClassName("com.yourproject", "com.yourproject.page2Activity"); startActivity(page2); </code></pre> <p>This should take you to the next class! Great huh? But we still need to use our page2.xml. You could use inflaters, (read up on those sometimes), but for beginner's sake just put </p> <pre><code>setContentView(R.layout.page2); </code></pre> <p>after </p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); </code></pre> <p>In your Page2Activity</p> <p>ONE MORE THING: You have to add your new activity to your manifest! Easy peasy. Open up your AndroidManifest.xml, and add</p> <pre><code>&lt;activity android:name=".Page2Activity"&lt;/activity&gt; </code></pre> <p>right after the first you see (which would be the main one)</p> <p>Try it out!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload