tags:

views:

46

answers:

2

Hello

In my layout I have in the upper part three views in a horizontal linear layout. When I enter the activity, one of these views must be selected depending on the pressed button in the previous activity. The selection is made using an ImageView indicator that must be centered below the selected view. Could anyone tell me what is the best way to do this?

Best Regards

A: 

Well If I 'm getting you correct you are talking about the functionality how to pass data variable V (button's state) from one activity to another so that in another activity you could use that variable V to show one of your view as selected.

Before starting your intent startActivity(intent);

do this

Intent intent = new Intent(A.this,B.class); intent.putExtra("selectedView","0");

success_anil
Gratzi
+1  A: 

You could use RelativeLayout and positon the ImageView below the selected view; either manually add the ImageView below the selected view, or have three ImageViews with visibility set to GONE (or INVISIBLE) and then set the correct ImageView to VISIBLE. Position the ImageView XML tag at the bottom of your XML layout so that it overlays the underlying view.

junkdog
I thought about that. The problem is that the top buttons must have a background image. So I've placed them in a linear layout and I've set the background image to that linear layout. The buttons must be centered on that header background image, and the indicator image, must be placed: - vertically at the bottom of that linear layout (header image), so that the indicator image blends with the header image; -horizontally aligned with the header buttons. Sorry for not specifying that before!
Gratzi