none
How to center rotated text in a textview in C#? RRS feed

  • Question

  • Using Visual Studio Community 2017.

    Have a LinearLayout whose child is a TextView.

    TextView should contain text rotated 270 degrees.

    Want to center that text.

    Done this through AXML but need to do it programmatically using C# as the text inside the Textview is dynamically generated.

    Anyone?

    Thanks in advance.

    Uttam


    Uttam Wear your intelligence like a fob watch. Don't keep pulling it out to refer to the time, But if asked, Tell it.

    Wednesday, August 23, 2017 6:19 AM

All replies

  • hello u0107,

    I'm confused about  your program type, Maybe you should tell me more information about your program , xamarin , uwp and others . and you should consider to post a new thread to their forums for a suitable support.

    Best regards,

    feih_7


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 24, 2017 6:34 AM
  • Hello feih_7,

    Thank you for responding.

    I use C# for developing an Mobile App - of which my first hurdle is to create an Android App.

    I do not use Xamarin or uwp or others - it is pure C# code.

    The UI skeleton is created using axml - and on that I add programmatically additional objects.

    One of the objects is a single row with some 100 columns, 40 pixels wide and 160 pixels high.  In each of these cells I have 8 characters - something like "08:15 PM" which are vertical (rotated 270).

    My challenge is that this  "08:15 PM" is aligned to the bottom so much so that the initial 0 is truncated.

    Hope this explains.

    Thank you for trying to help me.

    Best.

    Uttam


    Uttam Wear your intelligence like a fob watch. Don't keep pulling it out to refer to the time, But if asked, Tell it.

    Thursday, August 24, 2017 7:15 AM
  • Humm... I think you can refer to this StackOverflow thread.

    Sure this is Java not C#, but knowing that after you compile your project, it'll be compiled to equivalent Java classes, you'll understand you should just use the same approach you see in Java version.

    Thursday, August 24, 2017 9:54 AM