big virtual view and focus traversal

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

big virtual view and focus traversal

Postby pskink » Fri Mar 13, 2009 12:51 pm

hi,

i have one big virtual view which is made up from say 2 x 3 pages.

each page has its own focusable views and i got into two problems here:

1. how to restrict focus traverasal (DPAD keys) to only those views that are on current page?

2. how to detect if there no other view in specific direction that could take focus? for example i press left dpad key and if i'm on the lefmost focusable view i would like to swich to the page on the left. i saw there is dispatchUnhandledMove method but i cannot get it working (see HomeView class)

any ideas?
Attachments
Home.tar.gz
(59.29 KiB) Downloaded 39 times
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby MrSnowflake » Fri Mar 13, 2009 1:09 pm

For 1) You can make all views out of screen to be disabled or non selectable/focusable.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby pskink » Fri Mar 13, 2009 1:42 pm

MrSnowflake wrote:For 1) You can make all views out of screen to be disabled or non selectable/focusable.


good point! thanks a lot,

i din't think about so simple solution, sometimes little is beautiful... ;)

i think non focusable will be better since it doesn't change look of view (disabling view can change its look)

what about #2?
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby MrSnowflake » Fri Mar 13, 2009 1:45 pm

What about View.focusSearch()? Never used it, but might come in handy.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby pskink » Fri Mar 13, 2009 2:18 pm

MrSnowflake wrote:What about View.focusSearch()? Never used it, but might come in handy.


neither i used it, will give a try, thanx for tip

unfortunately setFocusable/setFocusableInTouchMode/setEnabled didn't work... i don't know why

see setCurrentPage in HomeView

thanks again
Attachments
Home.tar.gz
(59.41 KiB) Downloaded 40 times
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Fri Mar 13, 2009 2:35 pm

pskink wrote:unfortunately setFocusable/setFocusableInTouchMode/setEnabled didn't work... i don't know why

see setCurrentPage in HomeView


but setDescendantFocusability did the trick, also never used it before, another thing learnt ;)
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby pskink » Fri Mar 13, 2009 4:21 pm

solved #2

focusSearch would be better to fine tune focus traversal but dispatchUnhandledMove for my purpose perfectly suits

see it on the whole glory... ;)
Attachments
Home.tar.gz
Home app basic framework with Today page partially implemented
(59.56 KiB) Downloaded 42 times
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests