Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PickerView shown underneath of Dialog #5

Open
louiskhenghao opened this issue Oct 17, 2016 · 6 comments
Open

PickerView shown underneath of Dialog #5

louiskhenghao opened this issue Oct 17, 2016 · 6 comments

Comments

@louiskhenghao
Copy link

I have a dialog, and i have a button inside, when i click the button it will trigger the pickerView.
But the pickview is not shown above of my dialog but underneath. Any solution for this?

Thank you very much.

@RameshBhupathi
Copy link
Owner

Did u try with DialogFragment ?

@louiskhenghao
Copy link
Author

yes, the dialog is DialogFragment.

@CongBaDo
Copy link

I faced same problem. How to solve it?

@RameshBhupathi
Copy link
Owner

RameshBhupathi commented Oct 25, 2016

@llouiskhenghao @CongBaDo Can u please Post Your Code For ?

@CongBaDo
Copy link

CongBaDo commented Oct 25, 2016

This is DialogFragment with Picker
`public class FilterDialogFragment extends DialogFragment {
private String[] filters;

public FilterDialogFragment() {

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dialog_filter, container);
    getDialog().getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    getDialog().setTitle("Please enter username");

    CustomizedTextView customizedTextView = (CustomizedTextView)view.findViewById(R.id.tv_nationality_title);
    filters = getResources().getStringArray(R.array.filters);
    List<String> filterList = Arrays.asList(filters);

    LinearLayout llLocation = (LinearLayout)view.findViewById(R.id.ll_location);
    LinearLayout llRentType = (LinearLayout)view.findViewById(R.id.ll_rent_type);
    LinearLayout llBudget = (LinearLayout)view.findViewById(R.id.ll_budget);
    LinearLayout llNationality = (LinearLayout)view.findViewById(R.id.ll_nationality);
    LinearLayout llGender = (LinearLayout)view.findViewById(R.id.ll_gender);
    LinearLayout llAvailable = (LinearLayout)view.findViewById(R.id.ll_available_date);

    llLocation.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(1, getActivity());
        }
    });

    llRentType.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });

    llBudget.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });

    llNationality.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(2, getActivity());
        }
    });

    llGender.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showPickerView(4, getActivity());
        }
    });


    return view;
}

private void showPickerView(int i, final Context context){

    MyOptionsPickerView singlePicker = new MyOptionsPickerView(context);
    final ArrayList<String> items = new ArrayList<String>();
    if(i == 1){
        List<ItemLocation> locationList = CoreManager.getInstance().getItemLocationList();
        for(int m =0; m < locationList.size(); m++){
            items.add(locationList.get(m).name);
        }
    }else if(i == 2){
        List<ItemCountry> locationList = CoreManager.getInstance().getItemCountryList();
        for(int m =0; m < locationList.size(); m++){
            items.add(locationList.get(m).name);
        }
    }else if(i == 3){
        for(int m =0; m < 20; m++){
            items.add(String.valueOf(m+1));
        }
    }else if(i == 4){
        List<ItemBudget> budgets = CoreManager.getInstance().getItemBudgetList();
        for(int m = 0; m < budgets.size(); m++){
            items.add(budgets.get(m).min +" - "+budgets.get(m).min);
        }
    }else if(i == 5){

    }

    singlePicker.setPicker(items);
    singlePicker.setTitle(filters[i]);
    singlePicker.setCyclic(false);
    singlePicker.setSelectOptions(0);
    singlePicker.setOnoptionsSelectListener(new MyOptionsPickerView.OnOptionsSelectListener() {
        @Override
        public void onOptionsSelect(int options1, int option2, int options3) {
            Toast.makeText(context, "" + items.get(options1), Toast.LENGTH_SHORT).show();
        }
    });

    singlePicker.show();
}

}`

@Ankur008
Copy link

Any Solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants