为什么在处理DateTime选择器时 不会移动到DateTime选择器找到的布局
这是现有Aldata Time On Baker的课程:
public class Popactivity extends DialogFragment implements View.OnClickListener {
View view;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.pop, container, false);
return view;
}
@Override
public void onClick(View v) {
}
public void show(FragmentTransaction manager, Object o) {}
}
这是MainActivity类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
android.support.v4.app.FragmentTransaction manager =getSupportFragmentManager().beginTransaction();
Popactivity ppp=new Popactivity();
ppp.show(manager,null);
答案 0 :(得分:0)
此方法不需要存在。
public void show(FragmentTransaction manager, Object o) {}
至少,您不应该覆盖/重载现有的show(FragmentTransaction transaction, String tag)
方法。
如果删除它,则应该没有错误。
例如,这段代码编译得很好。
public class MainActivity extends android.support.v7.app.AppCompatActivity {
public static class PopUpFragment extends android.support.v4.app.DialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.pop, container, false);
return rootView;
}
}
@Override
protected void onCreate(Bundle b) {
super.onCreate(b);
setContentView(R.layout.activity_main);
PopUpFragment pop = new PopUpFragment();
pop.show(getSupportFragmentManager(), null);
}
}