Bog*_*iel 0 android android-studio
当使用dialogFragment时,我在片段顶部得到一个白色空格矩形而不知道原因.
我的DialogFragment:
public class SelectDialogFragment extends DialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//inflate layout with recycler view
View v = inflater.inflate(R.layout.select_frag, container, false);
return v;
}
}
Run Code Online (Sandbox Code Playgroud)
select_frag.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:orientation="vertical"
android:background="#000"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="New Text"
android:id="@+id/textView" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
你应该设置没有标题的样式:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_TITLE, 0);
}
Run Code Online (Sandbox Code Playgroud)
你也可以在这里找到更有用的例子
| 归档时间: |
|
| 查看次数: |
722 次 |
| 最近记录: |