Input text field

Started by Kaiidyn, January 27, 2011, 01:48:29 PM

Previous topic - Next topic

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

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).
Right here, right now ...or later in some other place

Kaiidyn

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

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


<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

Kaiidyn

#4
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
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