由于内部视图,对话增长

时间:2016-02-15 11:25:04

标签: android android-layout android-alertdialog android-appcompat flowlayout

对于包含内部视图的对话框,我有一个奇怪的问题 - FlowLayout。

在我向FlowLayout添加一些项目后,对话框和键之间的填充变得更大。即使我重新创建对话框,仍然存在填充。

public WatchersDialog(Context context) {
    super(context);
    init();
}

/**
 * Initialize drug picker dialog
 * Setup buttons and title and main view
 */
private void init() {
    if (Utils.getInternetConnectionType(getContext()) == Utils.NO_INTERNET) {
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        setCustomTitle(inflater.inflate(R.layout.wathcer_dialog_title, null));
    } else {
        setTitle(getContext().getString(R.string.watcher));
    }
    setView(getView(), 0, 0, 0, 0);
    setPositiveButton(R.string.save, (dialogInterface, i) -> {

    });
    setNegativeButton(R.string.cancel, null);
}

private LinearLayout getView() {
    LinearLayout view;
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view = (LinearLayout) inflater.inflate(R.layout.wathcer_dialog_layout, null);
    ButterKnife.bind(this, view);
    watcherFlowLayout.setListener(this);
    return view;
}
<?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="wrap_content"
    android:orientation="vertical">

    <android.support.v7.widget.AppCompatTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:background="@color/primary"
        android:lineSpacingMultiplier="1.2"
        android:paddingBottom="16dp"
        android:paddingLeft="24dp"
        android:paddingRight="24dp"
        android:paddingTop="16dp"
        android:text="+++"
        android:textColor="@android:color/white"
        android:textSize="16sp" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none">

        <com.it4medicine.nm.ui.view.WatcherListLayout
            android:id="@+id/watcher_flow_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="16dp" />
    </ScrollView>
</LinearLayout>

enter image description here enter image description here

0 个答案:

没有答案