hbb20 / CountryCodePickerProject

Country Code Picker (CCP) is an android library which provides an easy way to search and select country or international phone code. Also supports Android EditText phone mask and international phone validation.
Apache License 2.0
1.52k stars 506 forks source link

Is posible shows only the flag? #40

Closed rchampa closed 7 years ago

rchampa commented 7 years ago

Is posible shows only the flag?

longpham2310 commented 7 years ago

Yes. It possible. See my code below!

CountryCodePicker countryPicker = (CountryCodePicker) findViewById(R.id.countryPicker);
final TextView selectedCountryCodeTV = (TextView) countryCodePicker.findViewById(R.id.textView_selectedCountry);
selectedCountryCodeTV.setText(""); // Or set this textView is `Invisible`

countryCodePicker.setOnCountryChangeListener(new CountryCodePicker.OnCountryChangeListener() {
    @Override
    public void onCountrySelected() {
        if (selectedCountryCodeTV != null) {
            selectedCountryCodeTV.setText(""); 
        }
    }
});
hbb20 commented 7 years ago

Update to version 1.7.7 and set

    <com.hbb20.CountryCodePicker
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:ccp_showPhoneCode="false"
    app:hideNameCode="true" />

This will hide phone code from CCP and searchbox. Name code will be removed from CCP. Finally Flag will remain in CCP.