Click here to Skip to main content
15,916,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Java
public final class imagesGridViewScreen extends MainScreen 
{
	GridFieldManager grid;
	LabelField label;
	BitmapField message, call_logs, contacts, internet, calendar, camera, music;
	Bitmap msg, logs, cont, inter, calen, cam, mus;
    public imagesGridViewScreen()
    {            
        setTitle("MENU");
        label= new LabelField(" " , Field.FIELD_HCENTER)
		{
			protected void paintBackground(Graphics g) 
			{
				g.setBackgroundColor(Color.LIGHTGRAY);
				g.clear();
			}
		};
        grid = new GridFieldManager(4 ,4 , 0);
        msg = Bitmap.getBitmapResource("msg.png");
        message = new BitmapField(msg, BitmapField.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Messages");
        		Dialog.alert("Message icon selected");
        		return true;
        	}
        };
        logs = Bitmap.getBitmapResource("calllogs.png");
        call_logs = new BitmapField(logs, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Call logs");
        		Dialog.alert("Call Logs icon selected");
        		return true;
        	}
        };
        cont = Bitmap.getBitmapResource("contact.png");
        contacts = new BitmapField(cont, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Contacts");
        		Dialog.alert("Contacts icon selected");
        		return true;
        	}
        };
        inter = Bitmap.getBitmapResource("internet.png");
        internet = new BitmapField(inter, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Internet");
        		Dialog.alert("Internet icon selected");
        		return true;
        	}
        };
        calen = Bitmap.getBitmapResource("calendar.png");
        calendar = new BitmapField(calen, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Calendar");
        		Dialog.alert("Calendar icon selected");
        		return true;
        	}
        };
        cam = Bitmap.getBitmapResource("camera.png");
        camera = new BitmapField(cam, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Camera");
        		Dialog.alert("Camera icon selected");
        		return true;
        	}
        };
        mus = Bitmap.getBitmapResource("music.png");
        music = new BitmapField(mus, Field.FOCUSABLE)
        {
        	protected boolean navigationClick(int status,int time)
        	{
        		label.setText("Music");
        		Dialog.alert("Music icon selected");
        		return true;
        	}
        };
        grid.add(message, 0);
        grid.add(call_logs, 1);
        grid.add(contacts, 2);
        grid.add(internet, 3);
        grid.add(calendar, 4);
        grid.add(camera, 5);
        grid.add(music, 6);
        grid.setColumnPadding(20);
        grid.setRowPadding(20);
        add(grid);
    }
}

I have created a grid view now i want that when i scroll then icons or images should be highlighted or shown the scroll is on that image or icon??
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900