我试图找出hw从FUllscreen对话框中删除填充
下面是我们在创建对话框对象时使用的样式:
<style name="full_screen_dialog" parent="@android:style/Theme.Dialog">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<!-- No backgrounds, titles or window float -->
<item name="android:windowBackground">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:padding">0dp</item>
<item name="android:layout_margin">0dp</item>
<item name="android:layout_gravity">bottom</item>
<!-- Just to prove it's working -->
<item name="android:background">#00000000</item>
</style>
下面是对话框内容
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/main_content"
>
<RelativeLayout
android:id="@+id/layout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/layout1"
>
<com.theartofdev.edmodo.cropper.CropImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cropImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
app:cropAspectRatioX="5"
app:cropAspectRatioY="5"
app:cropShape="oval" />
</RelativeLayout>
<LinearLayout
android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100">
<Button
android:id="@+id/cancel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="50"
android:background="#a9aeac"
android:clickable="true"
android:focusable="true"
android:text="Cancel"
android:textColor="#000000" />
<Button
android:id="@+id/submit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="50"
android:background="#a9aeac"
android:clickable="true"
android:focusable="true"
android:text="Done"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
如何删除填充我设置了样式但它不起作用
答案 0 :(得分:0)
遵循以下代码:
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.your_dialog_content);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
答案 1 :(得分:0)
can you try set layouts without style class in xml file?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="@+id/add_school_schoolname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/collegename"
android:inputType="textPersonName" />
<EditText
android:id="@+id/add_school_schoolweb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/collegeweb"
android:inputType="textPersonName" />
<Button
android:id="@+id/add_school_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Submit" />
</LinearLayout>
</LinearLayout>