CountryCodePickerProject icon indicating copy to clipboard operation
CountryCodePickerProject copied to clipboard

Country code number gets replaced by ellipsis

Open cordeirovs opened this issue 7 years ago • 10 comments

How do I fix this issue? https://streamable.com/sawds

When I try to change from a 2 digit code to a 3 digit code (or 1 digit to a 2 or 3 digit code), the selected country code doesn't appear on the screen. For example, from +44 to +351, +351 gets replaced by +...

Thanks

cordeirovs avatar Dec 07 '18 13:12 cordeirovs

Looks like width of CountryCodePicker is not wrap_content. If that's not a problem, can you please post the xml file or part that contains ccp?

hbb20 avatar Dec 07 '18 14:12 hbb20

Here is the xml: As you can see, the width is set to wrap_content.

    android:id="@+id/phoneCardCountry"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_alignLeft="@+id/input_box"
    android:layout_alignStart="@+id/input_box"
    android:layout_marginLeft="15dp"
    android:layout_marginStart="15dp"
    app:ccp_contentColor="@color/c733abf"
    app:ccp_textSize="14sp"
    app:ccp_arrowSize="14sp"
    app:ccp_showNameCode="false"
    app:ccpDialog_allowSearch="false"
    app:ccp_defaultNameCode="PT"
    app:ccp_countryPreference="PT"
    app:ccp_defaultLanguage="PORTUGUESE"
    app:ccp_autoDetectCountry="true" />

cordeirovs avatar Dec 07 '18 14:12 cordeirovs

I think I got the problem. Can you show me entire container which contains ccp and input_box?

hbb20 avatar Dec 07 '18 14:12 hbb20

Here it is :) https://pastebin.com/7E5x5dSC

cordeirovs avatar Dec 07 '18 14:12 cordeirovs

Your layout arrangement looks good except the part where views left and right ends are aligned to an imageview(input_box) which has "wrap_content". So ultimately room for your ccp+editText is decided by the width of a "drawable" (of input_box). Which is not a good idea. To make sure it's the problem, can you try following?

change

   
        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:id="@+id/input_box"
        android:scaleType="fitCenter"
        android:src="@drawable/input_box"/>

to width = "match_parent"

   
        <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:id="@+id/input_box"
        android:scaleType="fitCenter"
        android:src="@drawable/input_box"/>

I am sure it's not going to look aligned in screen properly but this is just to test if that's the real issue.. Try this change and check if ellipsis shows up. Whatever is the result, please post back.

Thanks.

hbb20 avatar Dec 07 '18 14:12 hbb20

With that change the issue remains the same. I've replaced the screen layout with the following:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.hbb20.CountryCodePicker
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

If I change the CountryCodePicker width to match_parent the number is displayed correctly but with wrap_content it isn't.

cordeirovs avatar Dec 07 '18 15:12 cordeirovs

Hello! Any update about this issue? Thanks

cordeirovs avatar Dec 14 '18 14:12 cordeirovs

I was trying to reproduce it on my end but was not able to do that. I think if you can send me the exact background image that might help. On Fri, Dec 14, 2018 at 08:17 cordeirovs [email protected] wrote:

Hello! Any update about this issue? Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hbb20/CountryCodePickerProject/issues/267#issuecomment-447338354, or mute the thread https://github.com/notifications/unsubscribe-auth/AEsN6Pch3BjST0h3BHihN3G2DX4I0uQQks5u47MPgaJpZM4ZIdnV .

hbb20 avatar Dec 14 '18 14:12 hbb20

Hello, here it is: https://imgur.com/4B9J4GV

cordeirovs avatar Dec 17 '18 18:12 cordeirovs

Did you get the solution?

I tried with given image, this is what I got image

So it looks like you are managing width from parent container. Is that the case?

hbb20 avatar Jan 09 '19 05:01 hbb20