Android clickable layout

前端 未结 6 1311
旧时难觅i
旧时难觅i 2020-12-15 09:28

I\'ve got a linear layout that i have set true to be clikable + focus, But the problem is there is no focus displayed when clicked. How can i get the focus to be displayed.<

6条回答
  •  失恋的感觉
    2020-12-15 10:17

    Try to bring that layout to front in code:

    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
    
        View mainView = this.findViewById(R.id.mainView);
        this.setContentView(mainView);
    
        LinearLayout linear_tv_layout = (LinearLayout)mainView.findViewById(R.id.linear_tv_layout);
        linear_tv_layout.bringToFront();
        // or: mainView.bringChildToFront(linear_tv_layout);
    }
    

    If that does not work, check if there is one or more view overlapped over that LinearLayout.

提交回复
热议问题