Android: EditText hint in single line












21















For setting the Single Line in EditText we use android:singleLine="true" but I want to set the single line for the Hint Text, it is large and I want to show it in a one line like:




http://google.myopenid.stackoverflow.com




I am using the following code:



<EditText android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/defaultUrl"
android:singleLine="true" />


Note: defaultUrl is dynamic and very long URL.










share|improve this question

























  • so you wan tht hint url should be displayed at only as one line?

    – chikka.anddev
    Feb 2 '11 at 5:52











  • you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

    – Vikas Patidar
    Feb 2 '11 at 5:54













  • I am trying to show only the small url and then append like google.com/...

    – Sameer Z.
    Feb 2 '11 at 6:17
















21















For setting the Single Line in EditText we use android:singleLine="true" but I want to set the single line for the Hint Text, it is large and I want to show it in a one line like:




http://google.myopenid.stackoverflow.com




I am using the following code:



<EditText android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/defaultUrl"
android:singleLine="true" />


Note: defaultUrl is dynamic and very long URL.










share|improve this question

























  • so you wan tht hint url should be displayed at only as one line?

    – chikka.anddev
    Feb 2 '11 at 5:52











  • you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

    – Vikas Patidar
    Feb 2 '11 at 5:54













  • I am trying to show only the small url and then append like google.com/...

    – Sameer Z.
    Feb 2 '11 at 6:17














21












21








21


2






For setting the Single Line in EditText we use android:singleLine="true" but I want to set the single line for the Hint Text, it is large and I want to show it in a one line like:




http://google.myopenid.stackoverflow.com




I am using the following code:



<EditText android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/defaultUrl"
android:singleLine="true" />


Note: defaultUrl is dynamic and very long URL.










share|improve this question
















For setting the Single Line in EditText we use android:singleLine="true" but I want to set the single line for the Hint Text, it is large and I want to show it in a one line like:




http://google.myopenid.stackoverflow.com




I am using the following code:



<EditText android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/defaultUrl"
android:singleLine="true" />


Note: defaultUrl is dynamic and very long URL.







android android-edittext hint






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 26 '12 at 18:51









Idolon

22.5k1081106




22.5k1081106










asked Feb 2 '11 at 5:40









Sameer Z.Sameer Z.

2,39474071




2,39474071













  • so you wan tht hint url should be displayed at only as one line?

    – chikka.anddev
    Feb 2 '11 at 5:52











  • you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

    – Vikas Patidar
    Feb 2 '11 at 5:54













  • I am trying to show only the small url and then append like google.com/...

    – Sameer Z.
    Feb 2 '11 at 6:17



















  • so you wan tht hint url should be displayed at only as one line?

    – chikka.anddev
    Feb 2 '11 at 5:52











  • you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

    – Vikas Patidar
    Feb 2 '11 at 5:54













  • I am trying to show only the small url and then append like google.com/...

    – Sameer Z.
    Feb 2 '11 at 6:17

















so you wan tht hint url should be displayed at only as one line?

– chikka.anddev
Feb 2 '11 at 5:52





so you wan tht hint url should be displayed at only as one line?

– chikka.anddev
Feb 2 '11 at 5:52













you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

– Vikas Patidar
Feb 2 '11 at 5:54







you are using this long Hint Text in one line and does it make any sense when user won't be able to read all at once?

– Vikas Patidar
Feb 2 '11 at 5:54















I am trying to show only the small url and then append like google.com/...

– Sameer Z.
Feb 2 '11 at 6:17





I am trying to show only the small url and then append like google.com/...

– Sameer Z.
Feb 2 '11 at 6:17












3 Answers
3






active

oldest

votes


















49














You can use



android:ellipsize="end"



android:maxLines="1"



to show your hint text in single line but you wont be able to see the whole text because
android:ellipsize="end" truncates the text at the end.






share|improve this answer































    0














    Same issue.



    Solution:



    EditText.setHint("hint content".replace("n"," "))





    share|improve this answer





















    • 1





      This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

      – Agilanbu
      Nov 23 '18 at 7:24



















    -1














    You can try using



    android:maxLines="1"





    share|improve this answer



















    • 1





      I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

      – Sameer Z.
      Feb 2 '11 at 6:15











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4871152%2fandroid-edittext-hint-in-single-line%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    49














    You can use



    android:ellipsize="end"



    android:maxLines="1"



    to show your hint text in single line but you wont be able to see the whole text because
    android:ellipsize="end" truncates the text at the end.






    share|improve this answer




























      49














      You can use



      android:ellipsize="end"



      android:maxLines="1"



      to show your hint text in single line but you wont be able to see the whole text because
      android:ellipsize="end" truncates the text at the end.






      share|improve this answer


























        49












        49








        49







        You can use



        android:ellipsize="end"



        android:maxLines="1"



        to show your hint text in single line but you wont be able to see the whole text because
        android:ellipsize="end" truncates the text at the end.






        share|improve this answer













        You can use



        android:ellipsize="end"



        android:maxLines="1"



        to show your hint text in single line but you wont be able to see the whole text because
        android:ellipsize="end" truncates the text at the end.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 2 '11 at 6:27









        Vikas PatidarVikas Patidar

        33.7k2184100




        33.7k2184100

























            0














            Same issue.



            Solution:



            EditText.setHint("hint content".replace("n"," "))





            share|improve this answer





















            • 1





              This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

              – Agilanbu
              Nov 23 '18 at 7:24
















            0














            Same issue.



            Solution:



            EditText.setHint("hint content".replace("n"," "))





            share|improve this answer





















            • 1





              This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

              – Agilanbu
              Nov 23 '18 at 7:24














            0












            0








            0







            Same issue.



            Solution:



            EditText.setHint("hint content".replace("n"," "))





            share|improve this answer















            Same issue.



            Solution:



            EditText.setHint("hint content".replace("n"," "))






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 23 '18 at 8:03









            Shree

            12.7k2070122




            12.7k2070122










            answered Nov 23 '18 at 7:17









            XugterXugter

            11




            11








            • 1





              This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

              – Agilanbu
              Nov 23 '18 at 7:24














            • 1





              This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

              – Agilanbu
              Nov 23 '18 at 7:24








            1




            1





            This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

            – Agilanbu
            Nov 23 '18 at 7:24





            This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post instead, provide answers that don't require clarification from the asker

            – Agilanbu
            Nov 23 '18 at 7:24











            -1














            You can try using



            android:maxLines="1"





            share|improve this answer



















            • 1





              I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

              – Sameer Z.
              Feb 2 '11 at 6:15
















            -1














            You can try using



            android:maxLines="1"





            share|improve this answer



















            • 1





              I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

              – Sameer Z.
              Feb 2 '11 at 6:15














            -1












            -1








            -1







            You can try using



            android:maxLines="1"





            share|improve this answer













            You can try using



            android:maxLines="1"






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 2 '11 at 5:51









            amiekuseramiekuser

            1,38711530




            1,38711530








            • 1





              I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

              – Sameer Z.
              Feb 2 '11 at 6:15














            • 1





              I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

              – Sameer Z.
              Feb 2 '11 at 6:15








            1




            1





            I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

            – Sameer Z.
            Feb 2 '11 at 6:15





            I try it already ,it is not working. thanks for you support.If have any other idea or can just tell me how to customize the class.

            – Sameer Z.
            Feb 2 '11 at 6:15


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f4871152%2fandroid-edittext-hint-in-single-line%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen