Skip to content

dzenm/region-selection

Repository files navigation

region-selection

这是一个区域选择的工具

下载 (查看最新版本

implementation 'com.github.dzenm.region-selection:multi:1.0.0'

使用

1. 使用View实现

<com.dzenm.multi.RegionSelectionView
        android:id="@+id/region_view"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        app:layout_constraintBottom_toBottomOf="parent" />
final RegionSelectionView regionView = findViewById(R.id.region_view);
regionView.setOnSelectedListener(new RegionSelectionView.OnSelectedListener() {
    public void onCompleted(RegionBean[] regionData) {
        address.setText(getText(regionData));
    }
});

1. 使用PopupWindow实现

new RegionSelectionDialog.Builder(MainActivity.this)
        .setOnSelectedListener(new RegionSelectionDialog.OnSelectedListener() {
            @Override
            public void onCompleted(PopupWindow popupWindow, RegionBean[] regionData) {
                popupWindow.dismiss();
                reselected.setText(getText(regionData));
            }
        })
        .create(getWindow().getDecorView());

下载 APK