这是我如何调用我的DialogFragment:
以下是(部分)我的DialogFragment的创建方式:
问题在于总是显示一个令人烦恼的白色背景,如下所示。我该如何移除它?
以下是代码示例:
DialogSelectAccount myDiag=new DialogSelectAccount();
myDiag.show(ft,"Diag" );
以下是(部分)我的DialogFragment的创建方式:
public class DialogSelectAccount extends DialogFragment {
public DialogSelectAccount() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.dialog_select_account, container, false);
tvMessage = (TextView) rootView.findViewById(R.id.tvMessage);
btnAccountPublic = (Button) rootView.findViewById(R.id.btnAccountPublic);
btnAccountEnterprise = (Button) rootView.findViewById(R.id.btnAccountEnterprise);
tvMessage.setText(message);
btnAccountPublic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Login.setAccountType = 2;
dismiss();
}
});
btnAccountEnterprise.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Login.setAccountType = 1;
dismiss();
}
});
return rootView;
}
这是我 DialogSelectAccount 的 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff26b4e9"
android:orientation="vertical" >
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:textColor="@android:color/black"
android:textSize="15dp"
android:textAlignment="center"
android:gravity="center_horizontal"
android:background="#ff26b4e9"
android:autoText="true">
</TextView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#ff26b4e9"
android:orientation="horizontal" >
<Button
android:id="@+id/btnAccountPublic"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:clickable="true"
android:text="@string/accountPub"
android:textColor="#ffffffff"
android:background = "@drawable/roundedbutton" />
<Button
android:id="@+id/btnAccountEnterprise"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:clickable="true"
android:text="@string/accountEnt"
android:textColor="#ffffffff"
android:background = "@drawable/roundedbutton" />
</LinearLayout>
</LinearLayout>
问题在于总是显示一个令人烦恼的白色背景,如下所示。我该如何移除它?