Skip to content

XML Properties

Harsh Bhakta edited this page Oct 2, 2017 · 12 revisions

Here are all the XML properties available for CCP. Scroll down for detailed explanation of each...

<com.hbb20.CountryCodePicker
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	app:ccp_defaultNameCode=“US"
	app:ccp_defaultLanguage="FRENCH"
	app:ccp_contentColor="@color/custom_color"
	app:ccp_textSize="20sp"
	app:ccp_arrowSize="20dp"
	app:ccp_customMasterCountries="AD,BT,CL,HT,US,GB,OM,NZ"
	app:ccp_countryPreference="US,NZ"
	app:ccp_flagBorderColor="@color/custom_color"
	app:ccp_textGravity="RIGHT"
	app:ccp_showNameCode="false"
	app:ccp_showFlag="false"
	app:ccp_showFullName="true"
	app:ccp_clickable="true"
	app:ccp_showPhoneCode="false"
	app:ccp_autoDetectCountry="false"
	app:ccp_autoDetectLanguage="true"
	app:ccp_autoFormatNumber=“false"
	app:ccpDialog_keyboardAutoPopup="false"
	app:ccpDialog_allowSearch="false"
	app:ccpDialog_showPhoneCode=“false"
	app:ccpDialog_showFastScroller="false"
	app:ccpDialog_fastScroller_bubbleColor="@color/custom_color"
	app:ccpDialog_fastScroller_handleColor="@color/custom_color"
	app:ccpDialog_fastScroller_bubbleTextAppearance="@style/custom_textAppearance"
	app:ccpDialog_backgroundColor="@color/custom_color"
	app:ccpDialog_searchEditTextTint="@color/custom_color"
	app:ccpDialog_textColor="@color/custom_color"/>

app:ccp_defaultNameCode="US"

This is the country which will be set automatically when layout prepared. If auto_detect_country is enabled, this country will be set in CCP fails to detect country or something goes wrong.

app:ccp_defaultLanguage=“FRENCH" (Default : ENGLISH)

Your specified default language is loaded when layout is prepared. If auto_detect_launguage is enabled, this will be used as fall back language when CCP fails to detect language or detected language is not supported.

app:ccp_contentColor="@color/custom_color"

This will change the color of text and down arrow of CCP view.

app:ccp_textSize=“20sp"

Changes the size of CCP text. It also changes arrowSize accordingly unless explicitly stated using app:ccp_arrowSize.

app:ccp_arrowSize="20dp"

Specifies the size of downward arrow.

app:ccp_customMasterCountries="AD,BT,CL,HT,US,GB,OM,NZ"

Sets specified countries as master countries and will list only those countries to select from. If not specified, all the countries from library will be listed. [Read more]

app:ccp_countryPreference=“US,NZ"

Specified countries will be set as preferred countries and will be listed at the top of countries list. [Read more]

app:ccp_flagBorderColor="@color/custom_color"

If you feel like flags are not properly visible because of matching background color, you can give border color to the flag for better appearance.

app:ccp_textGravity=“RIGHT”

When width is “match_parent”, this will decide the gravity of text in CCP view.

app:ccp_showNameCode=“false" (Default : TRUE)

Decide whether to show name code on CCP. Default : TRUE

app:ccp_showFlag=“false" (Default : TRUE)

Toggles visibility of flag on CCP.

app:ccp_showFullName="true"

To show or hide full name of country on CCP. Default : FALSE

app:ccp_clickable=“false" (Default : TRUE)

Enable / disable click of ccp.

app:ccp_showPhoneCode=“false” (Default : TRUE)

To show or hide phoneCode from CCP. While using CCP as Country selector rather than Phone Code Picker, you want to remove phone code from CCP view. This will affect phone code of CCP_DIALOG unless specified using app:ccpDialog_showPhoneCode.

app:ccp_autoDetectCountry=“false” (Default : TRUE)

If enabled, it will detect country from device and set in CCP as soon as view is rendered. When CCP fails to detect country from device or something goes wrong, it will set your default country (or India, if not specified) as selected country. If disabled, it will load your specified default country (or India, if not specified) in the CCP when view is prepared.

app:ccp_autoDetectLanguage=“true" (Default : FALSE)

If enabled, it will detect device language and load CCP for that language. If CCP fails to detect the language or language is not yet supported, it will switch back to the app:ccp_defaultLanguage.

app:ccp_autoFormatNumber=“false" (Default : TRUE)

Auto formatter will format the number as user types number in registered editText.

app:ccpDialog_keyboardAutoPopup="false" (Default : TRUE)

Whether to show keyboard for search as soon as dialog for country selection is launched, is decided by this.

app:ccpDialog_allowSearch=“false" (Default : TRUE)

This will decide whether to allow search from list of countries. When your custom master list is really short, you might want to remove search option from CCP dialog.

app:ccpDialog_showPhoneCode=“false" (Default : TRUE or follows app:ccp_showPhoneCode when specified)

While using library as Country Selector, you don’t want to show phone code of countries in list. Normally, setting app:ccp_showPhoneCode as false is sufficient to hide phone code from both, CCP and CCP DIALOG as app:ccpDialog_showPhoneCode follows app:ccp_showPhoneCode by default.

app:ccpDialog_showFastScroller=“false" (Default: TRUE)

This enables / disables fastScroller for the CCP Dialog.

app:ccpDialog_fastScroller_bubbleColor=“@color/custom_color"

When fastScroller is enabled, this will be the background color of Index bubble.

app:ccpDialog_fastScroller_handleColor="@color/custom_color"

When fastScroller is enabled, this will be scroller handle color.

app:ccpDialog_fastScroller_bubbleTextAppearance="@style/custom_textAppearance"

This will be the textAppearance for bubble text.

app:ccpDialog_backgroundColor="@color/custom_color"

This### helps you modify theme of the dialog. This will be the background color for the CCP Dialog.

Clone this wiki locally