jPCT-AE - a 3d engine for Android > Support

Input text field

(1/1)

Kaiidyn:
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.

INeedMySpace:
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).

Kaiidyn:
Could you give me an example of this?
I can't even get an EditText to work propperly  :-X

Thanks in advance,
Kaiidyn.

INeedMySpace:
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: ---<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>

--- End code ---

Kaiidyn:
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

Navigation

[0] Message Index

Go to full version