how can display fancy button,menu (GUI)

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

how can display fancy button,menu (GUI)

Postby keraisureshv » Fri Jul 04, 2008 10:40 pm

i develop location base system so i need to develop menu but it's simple menu colume wise i need it row wise and so i need to develop that fancy menu so how we can develop fancy menu. can anybady know about fancy manu or button plz sent me info.

Thank You
Suresh kerai
I Develop Android Location Based System.
User avatar
keraisureshv
Freshman
Freshman
 
Posts: 5
Joined: Wed Jun 25, 2008 9:00 pm
Location: Ahmedabad

Top

Postby alpesh_harsoda » Fri Oct 24, 2008 11:49 am

That i also want to know bro.... 8) ......

hey location based system that also i m trying to do.........so can u solve my one problem that how can i check location update in emulator now because i dont have real device....

thnks bro....:)
User avatar
alpesh_harsoda
Senior Developer
Senior Developer
 
Posts: 106
Joined: Sat Sep 20, 2008 12:35 pm
Location: Rajkot,Gujarat(India)

Postby rmanromga » Sun Oct 26, 2008 5:59 am

It seems like what you want to do is to create a menu using Image Buttons please look at the InageButton API

http://code.google.com/android/referenc ... utton.html

and here is a snippet of how an image button would be used.. this is the xml layout file... the button1_image, button2_image, button3_image would be the images you would put in your drawables directory to make your buttons "fancy"

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <AbsoluteLayout android:id="@+id/widget30"
  2.  
  3.         android:layout_width="fill_parent"
  4.  
  5.         android:layout_height="fill_parent"
  6.  
  7.         android:background="@drawable/blue"
  8.  
  9.         xmlns:android="http://schemas.android.com/apk/res/android">
  10.  
  11.         <ImageButton android:id="@+id/button1"
  12.  
  13.                 android:layout_width="wrap_content"
  14.  
  15.                android:layout_height="wrap_content"
  16.  
  17.                 android:src="@drawable/button1_image" android:layout_x="10px"
  18.  
  19.                 android:layout_y="82px">
  20.  
  21.         </ImageButton>
  22.  
  23.         <ImageButton android:id="@+id/button2"
  24.  
  25.                 android:layout_width="wrap_content" android:layout_height="wrap_content"
  26.  
  27.                 android:src="@drawable/button2_image" android:layout_x="115px"
  28.  
  29.                 android:layout_y="80px">
  30.  
  31.         </ImageButton>
  32.  
  33.         <ImageButton android:id="@+id/button3"
  34.  
  35.                 android:layout_width="wrap_content" android:layout_height="wrap_content"
  36.  
  37.                 android:src="@drawable/button3_image" android:layout_x="220px"
  38.  
  39.                 android:layout_y="80px">
  40.  
  41.         </ImageButton>
  42.  
  43. </AbsoluteLayout
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


Hand here is how you would instantiate a button in the onCreate() function of your Activity

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  //Calendar Button
  2.  
  3.         ImageButton calendarButton = (ImageButton) findViewById( R.id.button1 );
  4.  
  5.         if( calendarButton == null ){
  6.  
  7.                 //calendar image not found
  8.  
  9.         }else{
  10.  
  11.                 calendarButton.setOnClickListener( new OnClickListener(){
  12.  
  13.                         public void onClick( View viewParam ){
  14.  
  15.                                 /*Create an Intent that will start your Activity */
  16.  
  17.                                 Intent activityIntent = new Intent( main.this, myActivity.class );
  18.  
  19.                                 main.this.startActivity( activityIntent );
  20.  
  21.                                
  22.  
  23.                         }
  24.  
  25.                 });
  26.  
  27.         }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


You also did not provide much in terms of what you have done and where you are getting stuck... there are many more code snippets on this site that deal with image buttons and you should use the search facility of the site and you should be able to get more information..

--D
rmanromga
Developer
Developer
 
Posts: 43
Joined: Thu Dec 20, 2007 6:21 am
Location: Baltimore, MD USA

Postby dkkundudolan » Fri Nov 28, 2008 5:32 am

Hi rmanromga ,

I have a problem. That is:
In the 1st screen i have the Image, textView and Button in same LinearLayout. (img1 in attachment). when i will click the "arrow" button in the right side of the screen, it will move to the next page (img2 in attachment). In the 2nd screen, there are check boxes. when i will click the checkbox and after that i will click on "Done" button, it will come back to the 1st screen.

Here on the 1st screen, the Image color will be changed as i selected the checkbox and also with that it will display with Implants that "one " or "two" items are selected. (Initially, Implants will show as "Implants(0). After clicking the checkboxes when i will come back to the 1st screen The Implants will be like this : "Implants(1/2)", if one check box selected."Implants(2/2)", if two checkboxes are selected).
and for the color change, i kept two ImageButton with different colors. So by selecting the checkbox, the Image color will be changed.

Please give me some suggestions. Hope for reply.

Thanks.
Attachments
img2.pdf
(27.75 KiB) Downloaded 124 times
Img1.pdf
(25.35 KiB) Downloaded 82 times
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Postby jagtap.jj1 » Fri Nov 28, 2008 12:47 pm

When u click on check box , U can dynamical change the image of ImageButton by using ib.setImageResource(R.drawable.green) function;
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby jagtap.jj1 » Fri Nov 28, 2008 12:51 pm

what u want , u designed this appl or want logic for this.
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Postby dkkundudolan » Tue Dec 23, 2008 7:22 am

Hi jagtap.jj1,

Thanks for your reply.
If i use the ib.setImageresource(R.drawable.green), how come the color of ImageButton will be changed ? The color of ImageButton will be depended on the checkboxes in the next page. if checkboxes are selected , den only the color will be changed.
Anyway i used Bundle in that and did this.

Another prob i have now. The ImageButon color is changing. but its not persistable. the color is going out if i go for the flow of the application.
So can you tell me how to keep the color persistable and it will be persistable upto the next time running the application. means when i will rum my application for the second time, in the second time, color may come back to red(previous) again. Again if i click the checkbox , the color will be green and it will be persistable upto the next time running..

Please can you help me in dis? Its very urgent?

Thanks.
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Postby jagtap.jj1 » Tue Dec 23, 2008 1:40 pm

Hello dkkundudolan

Some suggestion for logic, try this if possible
1.start the second activity having img2.pdf layout from first activity by using "public void startActivityForResult(Intent intent, int requestCode)" , when you click on Implants.

2.In main activity overrde "protected void onActivityResult(int requestCode, int resultCode, Intent data)" and in this function update your image of button , by calling setImageResource() as per result return from
second activity(whether check box is selected or not). So devise a logic in second activity, so that it will return check box state when it will exit(eg use some flags).
If you do this, it will be persistence.
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests