Mark M. | has entered the room |
Mark M. | turned on guest access |
Aug 16 | 10:05 AM |
Samuel | has entered the room |
Mark M. |
howdy, Samuel!
|
Mark M. |
how can I help you today?
|
Samuel |
Hi Mark
|
Samuel |
I develop an activity that consist of 2
framelayout for fragment A and fragment B. Fragment B will call fragment
C. Is it possible to use layout of fragment B as container of fragment
C?
|
Mark M. |
that depends on what you mean by "layout of fragment B"
|
Mark M. |
if you mean "the FrameLayout that holds fragment B", a replace() transaction can replace fragment B with fragment C
|
Mark M. |
if you mean "something inside fragment B", fragments cannot be nested, so this will not work reliably
|
Samuel |
I think the replace() is the best. Thanks
|
Samuel |
I'll try it
|
Aug 16 | 10:10 AM |
Samuel |
View paste
|
Aug 16 | 10:15 AM |
Mark M. |
then there is no android:tabLayout attribute, apparently
|
Mark M. |
I have not attempted using it and cannot comment as to whether or not it exists, or exists for all API levels
|
Samuel |
Okay, thank you. I think it's enough for now. Good bye
|
Samuel | has left the room |
Aug 16 | 10:20 AM |
Prasanna | has entered the room |
Prasanna |
Hi Mark
|
Prasanna |
How are you today?
|
Mark M. |
howdy, Prasanna!
|
Mark M. |
how can I help you?
|
Bruce F. | has entered the room |
Prasanna |
I am using a Spinner that is populated from an
ArrayAdapter. I want to have the Spinner say 'Select X'. But when you
click on the Spinner the expanded list should not have this 'Select X'.
The expanded list should only have the values that can be selected.
How do I do this?
|
Mark M. |
AFAIK, you don't
|
Mark M. |
or you create your own subclass of Spinner, perhaps, that has this behavior
|
Mark M. |
Spinners always have a selection, and that selection is always from its adapter
|
Prasanna |
Not sure what you mean by AFAIK
|
Mark M. |
AFAIK = as far as I know
|
Prasanna |
oh ok
|
Mark M. |
you *might* be able to create a tricky adapter
that can somehow handle this, but I have not tried it and do not know if
it could be made to work
|
Prasanna |
hmmm ok
|
Prasanna |
what I am trying to do is ...
|
Prasanna |
I have several spinners on the screen
|
Prasanna |
The 2nd Spinners values are dependent on the 1st Spinners selected value
|
Aug 16 | 10:25 AM |
Prasanna |
And I do not want to show the 2nd Spinner until the 1st Spinner ..
|
Prasanna |
value is selected
|
Prasanna |
That is whey i have 'Select X' in as the 1st value of the 1st Spinner
|
Prasanna |
So that when a value is selected on the 1st Spinner
|
Prasanna |
I can show the 2nd Spinner with the appropriate values.
|
Prasanna |
Any thoughts on how I can implement this?
|
Mark M. |
I wouldn't implement that
|
Mark M. |
and I have no good idea how you would
|
Prasanna |
so to take the user through a series of selections that depend on the previous selection ...
|
Prasanna |
what is a good way to do this in Android?
|
Mark M. |
for a two-tier structure, use an ExpandableListView
|
Mark M. |
for more than two tiers, use an ExpandableListView
followed by another activity/fragment that uses a ListView or another
ExpandableListView
|
Prasanna |
how is ExpandableListView different from ListView
|
Aug 16 | 10:30 AM |
Mark M. |
think of it as a two-tier "tree" widget
|
Mark M. |
groups and children
|
Prasanna |
do you have an example in the Busy Coder
|
Mark M. | |
Mark M. |
I am adding ExpandableListView to the Widget Catalog in the next version, due out around September 1st
|
Prasanna |
ok. I have about 4 tiers ...
|
Prasanna |
So when the user selects the 2nd tier in the 1st ExpandableListView I will have to take them to another activity/fragment?
|
Mark M. |
yes
|
Prasanna |
ok. Any ideas on where I can find a good example now on ExpandableListView?
|
Mark M. |
there should be stuff in the SDK's ApiDemos
|
Prasanna |
ok
|
Prasanna |
Thanks Mark!
|
Aug 16 | 10:35 AM |
Prasanna |
Good luck with all of your speaking engagements. Heading out. Have a great day!
|
Mark M. |
you too!
|
Prasanna | has left the room |
Bruce F. |
Howdy Mark.
|
Mark M. |
howdy, Bruce!
|
Bruce F. |
Based on your advice, I looked into using
SpannableStringBuilder and Html.fromHtml() to format text for a button.
But I’d like to lay out the depart and return buttons on the Kayak app.
I’ll upload a screen capture of what I’d like to accomplish:
|
Mark M. |
sorry I missed your arrival
|
Bruce F. | |
Bruce F. |
If <table> was supported, I’d have a clue…
|
Mark M. |
I suspect that those are not Button widgets
|
Mark M. |
AFAIK you could apply the Button background
resource to something else and work out the events to ensure that it
changes state appropriately on clicks
|
Aug 16 | 10:40 AM |
Mark M. |
another possibility is that they are empty Button
widgets into which they are drawing themselves, perhaps via a subclass,
with custom Canvas logic
|
Mark M. |
but, yeah, I don't think the Html.fromHtml() trick can handle this scenario
|
Bruce F. |
So would a TextView work?
|
Mark M. |
individually, no -- Button inherits from TextView
|
Mark M. |
per my first suggestion, that could conceivably by
a TableLayout, nested LinearLayouts, or a GridLayout, with multiple
TextView widgets, and a Button-style background on the container
|
Mark M. |
what makes a Button be a Button is mostly the background resource, a StateListDrawable
|
Mark M. |
I have not tried this, so I am presuming that it would work
|
Bruce F. |
So I could apply Html.fromHtml() to three separate TextViews, and wrap them in a layout?
|
Mark M. |
well, you would not need Html.fromHtml() to mimic what you see there in Kayak, but otherwise yes
|
Bruce F. |
Yeah, that just occured to me.
|
Bruce F. |
Thanks
|
Aug 16 | 10:45 AM |
Bruce F. |
One more...
|
Bruce F. |
Still trying to get imeOptions =”actionNext”
functionality for my two line EditText. Tried if(actionId ==
EditorInfo.IME_ACTION_NEXT), but in debug, the value of actionId appears
to be 0 every single time regardless. Then, with secondEditText being
where I want to transfer focus, I tried secondEditText.requestFocus().
Appears to have no effect. And secondEditText is focusable. Tried an
InputFilter, but that just limits the number of characters, and doesn’t
transfer focus. Any ideas?
|
Mark M. |
refresh my memory: is your problem when clicking the action button, when pressing Enter on the 2nd line, or both?
|
Bruce F. |
After entering one or two lines of text and
pressing Enter, it appropriately moves to the next EditText in 2.1,
does not in other versions I've tested.
|
Mark M. |
well, in the Enter scenario, since you are not clicking on the action button, I am not surprised that actionId is 0
|
Mark M. |
in the one case where I have a single-line EditText, I use if (event == null || event.getAction() == KeyEvent.ACTION_UP)
|
Mark M. | |
Bruce F. |
thanks, I'll check that.
|
Aug 16 | 10:50 AM |
Bruce F. |
One more... I remember seeing somewhere that after
the user clicks on the share icon, it can be configured to display the
most common or recent share resource. But now I can't find any info on
it. Can you direct me?
|
Bruce F. |
in the action bar that is.
|
Mark M. |
ShareActionProvider, IIRC
|
Mark M. |
specifically setShareHistoryFileName()
|
Mark M. |
or skip that to use a common history
|
Bruce F. |
Great, I'll check it out.
|
Bruce F. |
Thank you again.
|
Bruce F. |
Bye.
|
Bruce F. | has left the room |
Aug 16 | 10:55 AM |
Mark M. | turned off guest access |