나는이 조각을 사용하는 앱의 작동 확인, 하지만 난 버튼을 탭 도착하면 내가 this tutorial "Example of using PopupWindow"안드로이드 PopupWindow
하지만 다음하고,
일부 팝 업을 구현하기 위해 지금해야 이 오류를 얻을 : 여기
Multiple markers at this line
- LAYOUT_INFLATER_SERVICE cannot be resolved to a variable
- The method getBaseContext() is undefined for the type new
View.OnClickListener(){}
내 된 .java
public class Tab2HeadH1 extends Fragment implements OnClickListener{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.tab_2_head_buttons, container,false);
//Buttons
Button buttonNose = (Button) view.findViewById(R.id.button_pop_nose);
buttonNose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
//aqui tus tareas,,
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE); //ERRORS HERE!!
View popupView = layoutInflater.inflate(R.layout.popup, null);
final PopupWindow popupWindow = new PopupWindow(
popupView,
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
});
Button buttonEye = (Button) view.findViewById(R.id.button_pop_eye);
buttonEye.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
// onLoginClicked(v);
Toast.makeText(getActivity(), "ss9 eye",
Toast.LENGTH_SHORT).show();
}
});
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
((TabActivity)getActivity()).setHeader("TAPING APPLICATION");
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
}
}
}
그래, 어떻게이 문제를 해결할 수 있을까 ??, 내 조각을 탭에서 내 팝업을 보여?
고마워, 지금은 LayoutInflater layoutInflater = (LayoutInflater) getActivity(). getBaseContext(). getSystemService (LAYOUT_INFLATER_SERVICE); ,,,하지만이 오류가 발생합니다 : LAYOUT_INFLATER_SERVICE을 (를) 변수로 해결할 수 없습니다. 해결 방법은 무엇입니까? 감사! – MaKo
실제로 조각에서 호출하고 활동에서 컨텍스트가 필요하므로 서비스를 인식하지 못했습니다. 그것이 문맥을 얻는 순간 그것은 잘 작동합니다. – Android