Question

I currently have a SurfaceView (named BoardView) that is being stored in a FrameLayout. There is another LinearLayout (l1) that is stored in this FrameLayout(f1) which contains an EditText. I want to be able to bring the EditText to the front from within my BoardView. Is this possible? I tried using getParent().bringChildToFront(); but it didn't work. Any ideas?

public class Board extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);

    //use a frame layout so you can also display a dialog box
    // allows more than one view to be used
    FrameLayout f1 = new FrameLayout(this);
    LinearLayout l1 = new LinearLayout(this);
    EditText edit = new EditText(this);

    l1.setOrientation(LinearLayout.VERTICAL);
    l1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT));
    edit.setText("Enter your name!");
    l1.addView(edit);

    f1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 
            LayoutParams.FILL_PARENT));
    f1.addView(l1);
    f1.addView(new BoardView(this));

    setContentView(f1);

    //setContentView(new BoardView(this));
}

}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top