Stackover67
Stackover67

Reputation: 357

Don't loose focus on background activity after opening dialogfragment

I am opening a dialog fragment on Button click in a activity. Now I don't want loose focus on my background activity after opening the dialog fragment. The background activity has a chat window so the edit text in that chat window should not loose focus, to be more precise one should be able to chat even when the dialog fragment is open. Is there any way to make this happen?

Upvotes: 1

Views: 397

Answers (1)

WebInsight
WebInsight

Reputation: 307

One can place an individual layout( which is your dialog layout ) onto the center of the screen (gravity="center" or centerinParent="true") and set its visibility to invisible or gone.Then when you make the dialog layout appear, the edittext will be focusable as well.

I would encourage other answers which may be an alternative to this behavior which the OP wants.

Upvotes: 1

Related Questions