create menu popup

Put your problem here if it does not fit any of the other categories.

create menu popup

Postby rmeph » Wed Feb 06, 2008 3:31 pm

plz help me.....

i try to create a menu popup...
1 question is :it have a white background
2 question is : item have black color.....
3 question is :when i select last item and again select it come on first position.....is it possible??if yes then how to do that???
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby rmeph » Thu Feb 07, 2008 7:32 am

:roll:
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Fri Feb 08, 2008 5:18 pm

Hello rmeph,

you would have to create your own PopUpMenu, because up to now Android does not provide PopUpMenus (just the Menu-"Popup".

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Sat Feb 09, 2008 8:03 am

thanks for reply......
which is have menu popup in The Friend Finder application can we change it background color?????
and one more quesion what is use of "android.widget.MenuBuilder" class????
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Sat Feb 09, 2008 12:15 pm

Hello rmeph,

the "android.widget.MenuBuilder" is a Class that implements the "android.view.Menu"-Interface, which is passed to i.e. the onCreateOptionsMenu(Menu menu)-method.

Altering the MenuStyle should be possible by creating a theme (i.e. file res/values/mytheme.xml):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <style name="MyTheme" parent="Theme.Dark">
  2.        <!-- ..... -->
  3.        <item name="menuItemBackground">@drawable/menuitem_background</item>
  4.        <item name="menuItemTextColor">?panelTextColor</item>
  5.        <item name="menuItemTextSize">?panelTextSize</item>
  6.        <item name="menuItemTextStyle">?panelTextStyle</item>
  7. </style>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


Further read: :arrow: :src: Applying a Theme to your Application.

Hope it helps :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Mon Feb 25, 2008 10:37 am

in created theme i used
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <style name="MyTheme" >
  2.  
  3.  
  4.  
  5.        <item name="menuItemTextColor">?panelTextColor</item>
  6.  
  7.        <item name="menuItemTextSize">?panelTextSize</item>
  8.  
  9.        <item name="menuItemTextStyle">?panelTextStyle</item>
  10.  
  11. </style>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


it show error No resource found that match the given name attribute:'menuItemTextcolor' Value:'id'

and i try

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <style name="MyTheme"  parent="Theme">
  2.  
  3.  
  4.  
  5.        <item name="menuItemTextColor">?panelTextColor</item>
  6.  
  7.        <item name="menuItemTextSize">?panelTextSize</item>
  8.  
  9.        <item name="menuItemTextStyle">?panelTextStyle</item>
  10.  
  11. </style>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

it show error Error retreving parent for item No resource found that matches the given name Theme.
in place of "parent="Theme""
i try
parent="Theme.Dialog"
parent="Theme.Black"
but show same error how to solved that???
i m using m5 sdk
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby plusminus » Mon Feb 25, 2008 1:49 pm

Hello rmeph,

sorry I should not have shorted the example that much..

Using the ? you can refer to a value that has already been set in the same theme:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <style name="ThemeNew">
  2.    <item name="windowFrame">@drawable/screen_frame</item>
  3.    <item name="windowBackground">@drawable/screen_background_white</item>
  4.    <item name="panelForegroundColor">#FF000000</item>
  5.    <item name="panelBackgroundColor">#FFFFFFFF</item>
  6.    <item name="panelTextColor">?panelForegroundColor</item>
  7.    <item name="panelTextSize">14</item>
  8.    <item name="menuItemTextColor">?panelTextColor</item>
  9.    <item name="menuItemTextSize">?panelTextSize</item>
  10. </style>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


as parent, maybe try:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. parent="android:Theme.Black"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Mon Feb 25, 2008 5:53 pm

it's show error

android.view.ViewInflate$InflateException: Binary xml file line#34: Error inflating class java.lang.reflect.Constructor

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. OnCreated(){
  2.  
  3. settheme(R.style.ThemeNew);//here error show
  4.  
  5. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Mon Feb 25, 2008 6:34 pm

So what are the lines around #34 in that xml-file :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Tue Feb 26, 2008 7:06 am

so sorry it others problem

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <style name="ThemeNew">
  2.  
  3.    <item name="windowFrame">@drawable/screen_frame</item>
  4.  
  5.    <item name="windowBackground">@drawable/screen_background_white</item>
  6.  
  7.    <item name="panelForegroundColor">#FF000000</item>
  8.  
  9.    <item name="panelBackgroundColor">#FFFFFFFF</item>
  10.  
  11.    <item name="panelTextColor">?panelForegroundColor</item>
  12.  
  13.    <item name="panelTextSize">14</item>
  14.  
  15.    <item name="menuItemTextColor">?panelTextColor</item>
  16.  
  17.    <item name="menuItemTextSize">?panelTextSize</item>
  18.  
  19. </style>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4

and parent="android:Theme.Black"
parent="android:Theme.Theme"
parent="android:Theme.Black"
parent="android:Theme.ContextMenu"
parent="android:Theme.ExpandedMenu"........

it show error No resource found that match the given name attribute:'menuItemTextcolor' Value:'id'
it show error No resource found that match the given name attribute:'menuItemTextSize' Value:'id'
it show error No resource found that match the given name attribute:'panelTextSize' Value:'id'
it show error No resource found that match the given name attribute:'panelTextColor' Value:'id'
it show error No resource found that match the given name attribute:'panelBackgroundColor' Value:'id'
it show error No resource found that match the given name attribute:'panelForegroundColor' Value:'id'
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Tue Feb 26, 2008 7:47 pm

Maybe something changed since m5 :?

try altering "name" to other things. Perhaps android:name or android:id ...

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Sat Mar 08, 2008 1:13 pm

it cannot solved....plz help me
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby Pagemech » Thu May 08, 2008 12:49 pm

Hi there!

I have the same problem with the xml attribute: menuItemTextColor
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <item name="menuItemTextColor">?panelTextColor</item>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Also gives me the Error: No resource found....

But: I found the reason...
When looking at this list you will see that the xml element "menuItemTextColor" has been removed with the migration from m3 to m5.

The only thing that i found until now which could be used for changing menuitems is this one:
Menu_itemTextAppearance

But it is not very well documented and i haven't found out how to use it.

I think you are using even more xml attributes that have been removed.

If you find out anything about replacements for the removed attributes i would be glad about infos (especially for changing the text color of menu items)

Greetz
Pagemech
Freshman
Freshman
 
Posts: 6
Joined: Thu May 08, 2008 12:34 pm

Postby ebersmoll » Wed Jun 11, 2008 7:15 am

how do i use MenuBuilder

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public boolean  onCreateOptionsMenu(MenuBuilder menu    ) {
  2.  
  3.                        
  4.  
  5.                    
  6.  
  7.                    
  8.  
  9.                     super.onCreateOptionsMenu(menu);
  10.  
  11.                 menu.add(0, 1, "menubuilder");
  12.  
  13.                     SubMenu sub = menu.addSubMenu(0, 1, "options";
  14.  
  15.                
  16.  
  17.                     menu.add(0,4, "back");
  18.  
  19.                     return true;
  20.  
  21.                 }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


by so doing i am not able to have a clickable menu

the documentation all mention that it is a
Implementation of the Menu interface for creating a standard menu UI.

how do i initialize it and use it
Windmill windmill on the land
love forever love is free
ebersmoll
Freshman
Freshman
 
Posts: 7
Joined: Fri Apr 04, 2008 4:41 am
Location: Delhi

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 13 guests