Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

Android Fragment and getWindow()

public class AircraftFragmentTab extends Fragment{
      private String ac;
      
      public AircraftFragmentTab(String AC){
          ac = AC;
         
      }
         @Override
         public View onCreateView(LayoutInflater inflater, ViewGroup container,
         Bundle savedInstanceState)
         {
             View aircraftView = inflater.inflate(R.layout.acdetails, container, false);
             
             ??? getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
              WebView wv = (WebView) aircraftView.findViewById(R.id.webac);
              wv.getSettings().setJavaScriptEnabled(true);
              wv.loadUrl("http://ABCD/ACInfo.aspx?AC=" + ac);
              
             return aircraftView;
         }
}

I am using a webView and class extends from Fragment. How can I use getWindow() here ?

question from:https://stackoverflow.com/questions/7600858/android-fragment-and-getwindow

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you can use getActivity().getWindow()
this getActivity() will Return the Activity this fragment is currently associated with.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...