07.10.2011 21:01, Raffaele Sgarro пишет:
Hi Kostya, you must be the author of WiFi manager :) Nice to meet you

I am. Just wanted a little widget for myself, then it kind of went out of control :)


The problem here is not about visual appearance, it's about EditText behavior :) I agree that UIs should be as intuitive as possible, so I can make you an example of what I want to implement. Imagine to have a 7x7 table of TextViews. Obviously the cells are little and the text is ellipsized. I want that when the user taps a cell, a bigger popup displays more information, and when the user long taps the cell, he can directly edit the text in it. I think it's a good design but anyway once the app is out, users will judge it :)

Ah, so it's a spreadsheet type thing. Understand.

Well, in that case, I wouldn't try to create a switchable two-in-one widget.

I'd just create an EditText somewhere in the layout, initially hidden, and position and show it over a cell when needed, then hide (when detecting a click on another cell).

To do this, you'd need to watch click events for all text cells, and keep track of which one you're currently editing.

As far as positioning goes, you could add just one RelativeLayout in the entire content hierarchy specifically for this, or (probably) use a PopupWindow, it has an option to hide automatically when there is a click outside of its boundaries.

I would let EditText use its default font size so it's more familiar to the user, and position it centered over the cell.

The IME should show if you requestFocus() on the EditText, or else you can use this:

http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#showSoftInput(android.view.View, int) <http://developer.android.com/reference/android/view/inputmethod/InputMethodManager.html#showSoftInput%28android.view.View,%20int%29>

-- Kostya


I need to know more about how focus is managed on Android platform. Here are some questions

 1. Is there ALWAYS a focused element? Or can the focus be empty?
 2. How does the soft keyboard relate to the focus?


2011/10/7 Kostya Vasilyev <[email protected] <mailto:[email protected]>>

    Some of the things can be done with drawable state list(s) and stuff.

    The standard EditText uses a state-list drawable for its
    background, it can be found under:

    android-sdk\platforms\platform-X\data\drawable.

    The name can be found by looking in the platform's styles.xml:

    <style name="Widget.EditText">
    <item name="android:focusable">true</item>
    <item name="android:focusableInTouchMode">true</item>
    <item name="android:clickable">true</item>
    <item name="android:background">@android:drawable/edit_text</item>
    <item
    
name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
    <item
    name="android:textColor">@android:color/primary_text_light</item>
    <item name="android:gravity">center_vertical</item>
    </style>

    So it's drawable/edit_text.xml you want.

    It should be possible to create a similar background state-list
    XML, to be transparent (or white without the border) for when the
    EditText is not focused.

    As for the rest of you requirements, including a long press to
    enter editing...

    I believe - as a user - that UIs should be predictable and
    consistent with the platform's conventions, but maybe I'm just too
    old for this mobile computing thing :)

    -- Kostya

    07.10.2011 20:29, Studio LFP пишет:

        You could still use my code but instead of using it straight,
        you could just wrap it in a custom view. So instead of just a
        TextView or EditView, use the above code wrapped in a custom
        View and have the TextView/EditView inside it. Use the swap
        code there and it would actually a bit more simple because you
        could hold the data on the custom view and it would still fit
        inside your layout like the existing views.

        Steven
        Studio LFP
        http://www.studio-lfp.com
-- You received this message because you are subscribed to the Google
        Groups "Android Developers" group.
        To post to this group, send email to
        [email protected]
        <mailto:[email protected]>
        To unsubscribe from this group, send email to
        [email protected]
        <mailto:android-developers%[email protected]>
        For more options, visit this group at
        http://groups.google.com/group/android-developers?hl=en


-- Kostya Vasilyev


-- You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to