Open IWMTom opened 6 years ago
Are you setting the view to a default value? And is the hint flag disabled either in your code or in the xml?
It may be helpful if you could post how you're initializing the view so we can determine what's going on. By default, there should be no value present and the hint should appear unless it's disabled.
On Fri, Apr 27, 2018 at 8:03 AM, Tom Wilson notifications@github.com wrote:
By default, the hint is displaying as £0.00 and despite changing android:hint, it will not budge.
I say it's displaying the hint, it seems to be the text value rather than the hint value (the EditText style for a hint is a dulled grey, this is black).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BlacKCaT27/CurrencyEditText/issues/47, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_54ZC6PiwtAg9Rj7zGHB2BJxNDrG3eks5tswkOgaJpZM4TqQSc .
The Fragment is inflated from onCreateView() as default Fragment operation - the field isn't referenced at any point in the code, only in the XML.
I replaced a stock EditText element with a CurrencyEditText - I've tried to override the hint both with the text I need to be displayed, and an empty string - it doesn't make a difference.
This is what is displayed by default:
Code attached - nothing unusual! I've tried removing the custom style for the EditText, and that makes no difference.
Thanks.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Bundle arguments = getArguments();
final Listing selectedListing = (Listing) arguments.getSerializable("selectedListing");
getActivity().setTitle("New Bid");
final View view = inflater.inflate(R.layout.fragment_new_bid, container, false);
setHasOptionsMenu(true);
return view;
}
<com.blackcat.currencyedittext.CurrencyEditText
android:id="@+id/editText_bid_amount"
style="@style/AppTheme.EditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Bid Message"
app:layout_constraintBottom_toTopOf="@+id/editText_bid_message"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
Hm. Does seem like something may be wrong then, the text box should be showing "Bid Message" as hint text. it appears something in the initialization within the library code is setting a default value.
Try obtaining a reference to the view in your code and calling setHint on that after the view's been inflated. Not proposing this as a final solution, but just as a workaround to see if it works and if so give you a temporary solution until I have time to take a look.
On Fri, Apr 27, 2018 at 8:46 AM, Tom Wilson notifications@github.com wrote:
The Fragment is inflated from onCreateView() as default Fragment operation
- the field isn't referenced at any point in the code, only in the XML.
I replaced a stock EditText element with a CurrencyEditText - I've tried to override the hint both with the text I need to be displayed, and an empty string - it doesn't make a difference.
This is what is displayed by default:
[image: image] https://user-images.githubusercontent.com/8270461/39363067-d652d534-4a20-11e8-8327-6396d5f7edd5.png
Code attached - nothing unusual! I've tried removing the custom style for the EditText, and that makes no difference.
Thanks.
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); final Listing selectedListing = (Listing) arguments.getSerializable("selectedListing"); getActivity().setTitle("New Bid"); final View view = inflater.inflate(R.layout.fragment_new_bid, container, false); setHasOptionsMenu(true); return view; }
<com.blackcat.currencyedittext.CurrencyEditText android:id="@+id/editText_bid_amount" style="@style/AppTheme.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:layout_marginEnd="16dp" android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:ems="10" android:hint="Bid Message" app:layout_constraintBottom_toTopOf="@+id/editText_bid_message" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/divider2" />
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BlacKCaT27/CurrencyEditText/issues/47#issuecomment-384959729, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_54bAdC_mdMlBCKRloGQWmPIzI9MgPks5tsxMtgaJpZM4TqQSc .
I've given that a go, and it's still showing £0.00.
It's worth noting (you may have overlooked this in the OP) that this £0.00 value doesn't seem to be a hint, but is instead the text value of the field; it's black, and the cursor goes to the end of it by default when focusing.
Thanks for looking into it. :)
Not sure why, but I've given that another go and it does in fact show the correct hint now - I must have referenced the wrong EditText when setting to null.
The temporary workaround.. works!
@IWMTom @BlacKCaT27 I still cannot get the hint to change, can you share code?
@IWMTom @BlacKCaT27 So do I. I also cannot change the hint. Could you please explain more how you did?
I decided not to use it because I could not guys way around it.
On Wed, 23 Jan 2019, 13:08 mesrbn <notifications@github.com wrote:
So do I. I also cannot change the hint. Could you please explain more how you did?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BlacKCaT27/CurrencyEditText/issues/47#issuecomment-456794844, or mute the thread https://github.com/notifications/unsubscribe-auth/AIqaXboPaWGF-c7okqE1TCouE5KoCywuks5vGF60gaJpZM4TqQSc .
£0.00 is not the hint, it's the text. So putting currencyEditText.setText(null); in your onCreate() method will make your hint visible.
By default, the hint is displaying as £0.00 and despite changing android:hint, it will not budge.
I say it's displaying the hint, it seems to be the text value rather than the hint value (the EditText style for a hint is a dulled grey, this is black).