我正在尝试在 Dialog 或 DialogFragment 中嵌入 Fragment
public class addAccountDialog extends DialogFragment
{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
View view = inflater.inflate(R.layout.add_account_dialog, container);
accountType.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id)
{
passwordFragment newFragment = new passwordFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_base, newFragment);
transaction.commit();
}
}
}
}
<LinearLayout
android:id="@+id/fragment_base"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="3" >
</LinearLayout>
我已经尝试过使用 Dialog 和 DialogFragment 无济于事。有没有人能够在对话框中实现片段。
先感谢您。
罗杰