2

I want the edittext to be "multiline" at the same time need an "Done" button on the softKeyBoard to hide the softKeyBoard. I have the following code

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >
        <EditText 
            android:id="@+id/etMultiLineDone"
             android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:scrollHorizontally="false"
            android:inputType="textImeMultiLine"
            android:imeOptions="actionDone"
            android:lines="3"/>
        </LinearLayout>

When I try the above code in

setContentView(R.layout.activity_main); It works as expected

But when I try the same textview in a Custom Dialog it does not give the same functionality.

android:scrollHorizontally="false" - not working
android:inputType="textImeMultiLine" - not working
android:imeOptions="actionDone" - working
android:lines="3" - not working

    Dialog d = new Dialog(context);
    d.setTitle("dialog");
    d.setContentView(R.layout.dialog);
    d.show();

Help/ suggestions much appreciated. Thank you.

BRDroid
  • 3,920
  • 8
  • 65
  • 143
  • Which functionality is different? Is it lacking the multi-line or lacking the done-button, both, or something else different? – Reed Feb 13 '14 at 16:37
  • Hi, I have edited the details. please have a look. thank you – BRDroid Feb 13 '14 at 16:46
  • Experts... Any suggestions please. Thank you – BRDroid Feb 14 '14 at 13:35
  • I'm thinking it may be a limitation of Dialog, but I couldn't find anything to confirm it. I don't think it should make a difference, but you could try removing the `LinearLayout` or create the `EditText` all in code. You could also try using `AlertDialog` and `setView` instead of `Dialog`. I don't think any of that should actually make a difference, but It may be possible. – Reed Feb 14 '14 at 17:12
  • Alternatively, it would be a bit more complex, because you'd have to make a new activity, but you can make an activity show as a Dialog and then set whatever you want to it. You would just add `android:theme="@android:style/Theme.Dialog"` to the `` tag. See http://stackoverflow.com/questions/1979369/android-activity-as-a-dialog – Reed Feb 14 '14 at 17:14
  • Thanks for that, I will try it but the thing is i have around 20 dialogs where i gather form information. – BRDroid Feb 15 '14 at 09:14
  • 1
    This seems to be the case for any type of activity, not just for Dialog. As soon as you tell Android that it's a multiline textedit, out goes everything else. – Phil Ryan Sep 05 '14 at 03:25

0 Answers0