Giter Site home page Giter Site logo

Comments (9)

entropitor avatar entropitor commented on July 29, 2024

I guess, the line wrapping we use in the events itself should maybe applied to the header column as well.

(Feel free to take a look in the code and submit a Pull Request for this issue. Any help is greatly appreciated!)

from android-week-view.

jhoobergs avatar jhoobergs commented on July 29, 2024

@kelvin-huan-kok-yang Have you tried SimpleDateFormat format = new SimpleDateFormat("yyyy\n\n\n EEE\n\n\n MMM d", Locale.getDefault()); ?

Android uses 3 time \n most of the time instead of just \n

from android-week-view.

kelvin-huan-kok-yang avatar kelvin-huan-kok-yang commented on July 29, 2024

@caske33
I could not found any line wrapping setting in the events itself...even if WeekView.java...
mHeaderTextHeight, mHeaderHeight, mHeaderMarginBottom, mHeaderColumnWidth, mHeaderColumnPadding, mHeaderRowPadding
These are all float attribute related to header...i think not really related to multi-line right ? just editable design for the text space...
If I able to make multi-line...i will submit a Pull Request :)

@jhoobergs
For the triple \n, I have tried just now...but ends up with 3 white space...haha

from android-week-view.

jhoobergs avatar jhoobergs commented on July 29, 2024

@kelvin-huan-kok-yang Change the drawing of the header text to use the StaticLayout class as used to draw the event titles: https://github.com/Quivr/Android-Week-View/blob/develop/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1088
I think that should work.

from android-week-view.

kelvin-huan-kok-yang avatar kelvin-huan-kok-yang commented on July 29, 2024

@jhoobergs i done it with multi-line ! thanks ! πŸ‘
but currently still got a problem... the third line will "crash" with the event background
and the font size is small...although font size can be increased by using :- (but the "crash" problem will still exist) :(

float fontSize = 25;
mTextPaint.setTextSize(fontSize);

The multi-line is achieve using StaticLayout

String dayLabel = getDateTimeInterpreter().interpretDate(day);
if (dayLabel == null) 
    throw new IllegalStateException("A DateTimeInterpreter must not return null date");

TextPaint mTextPaint=new TextPaint();
StaticLayout mTextLayout = new StaticLayout(dayLabel,mTextPaint
    (int)mWidthPerDay,
    Layout.Alignment.ALIGN_NORMAL, 
    2, 0.5f, false);

canvas.save();

float textX = startPixel + mWidthPerDay / 2;
 loat textY = mHeaderTextHeight + mHeaderRowPadding ;
canvas.translate(textX, textY);

mTextLayout.draw(canvas);
canvas.restore();

drawAllDayEvents(day, startPixel, canvas);
startPixel += mWidthPerDay + mColumnGap;

aa

from android-week-view.

jhoobergs avatar jhoobergs commented on July 29, 2024

@kelvin-huan-kok-yang I think you need to set the mHeaderTextHeight variable to the right value

from android-week-view.

jhoobergs avatar jhoobergs commented on July 29, 2024

@kelvin-huan-kok-yang any update ?

from android-week-view.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on July 29, 2024

Did you guys get it right eventually ?

from android-week-view.

AndroidDeveloperLB avatar AndroidDeveloperLB commented on July 29, 2024

Ok I did it myself:
#97 (comment)
:)

from android-week-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.