Author Topic: Input text field  (Read 2096 times)

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Input text field
« on: January 27, 2011, 01:48:29 pm »
How would i go about making a working input text field?
Like enter your name to add high-score or something.

Thanks in advance,
Kaiidyn.
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

Offline INeedMySpace

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Input text field
« Reply #1 on: January 27, 2011, 03:12:48 pm »
Hi, I think one way is to separate 3D in GLSurfaceView and Android Widgets like EditText in the other layer.
In RelativeLayout for example.
I have tested it and it works.
Also you can change background for EditText from Android standart - android:background="@android:drawable/editbox_background" to something suits your needs. (I haven't tested it yet, but i thinks there should not be any problem).
Right here, right now ...or later in some other place

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Input text field
« Reply #2 on: January 27, 2011, 10:21:36 pm »
Could you give me an example of this?
I can't even get an EditText to work propperly  :-X

Thanks in advance,
Kaiidyn.
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

Offline INeedMySpace

  • byte
  • *
  • Posts: 9
    • View Profile
Re: Input text field
« Reply #3 on: January 28, 2011, 02:32:29 pm »
General info about RelativeLayout - http://developer.android.com/resources/tutorials/views/hello-relativelayout.html.
So you need to add GLSurfaceView in your layout - small modification of example from link

Code: [Select]
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <android.opengl.GLSurfaceView
         android:id="@+id/iglsurfaceview"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
    />
    <TextView
        android:id="@+id/label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Type here:"/>
    <EditText
        android:id="@+id/entry"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:drawable/editbox_background"
        android:layout_below="@id/label"/>
    <Button
        android:id="@+id/ok"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/entry"
        android:layout_alignParentRight="true"
        android:layout_marginLeft="10dip"
        android:text="OK" />
</RelativeLayout>
Right here, right now ...or later in some other place

Offline Kaiidyn

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Input text field
« Reply #4 on: January 28, 2011, 05:10:36 pm »
Hmm, is it possible to do this without xml?
I seriously don't like to use it, and would like to do it with code.


Edit: with a lot of pain in my guts i'll be using xml from now on, as it is kinda easier to use anyway. :p
« Last Edit: January 29, 2011, 01:30:40 pm by Kaiidyn »
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch