get parent's view from a layout

后端 未结 7 2396
囚心锁ツ
囚心锁ツ 2020-12-25 09:54

I have a FragmentActivity with this layout:




        
7条回答
  •  青春惊慌失措
    2020-12-25 10:17

    If you are trying to find a View from your Fragment then try doing it like this:

    int w = ((EditText)getActivity().findViewById(R.id.editText1)).getLayoutParams().width;
    

提交回复
热议问题