语言

Menu
Sites
Language
EDJE TEXT wrapping

Hello guys,

So i have TEXT part in EDJE and some long text that should be posted in 2 lines.

When i am doing like this
      part
      { name: "test"; type: TEXT;
        description { state: "default" 0.0;
                      rel1 { relative: 0.0 0.0; }
                      rel2 { relative: 1.0 1.0; }
                      color: 145 151 163 255;
                      text { font: "TizenSans:style=Medium"; size: 18; text: "very very very very very long text"; }
                      min: 250 50;
                      max: 250 50;
                    }
      }

The text will be wrapped with "..." when it reaches the end of the container with 250 px.

I need to put this text in 2 lines. So wrap first line with 250 px and write second line and only then wrap it with "..." if needed/

Is it possible to do in EDJE or maybe i should use code and how can i do this feature?

查看选择的答案

响应

6 回复
Jean Yang

Hi, 

There is a way to change line .. in code, you will see the string start by "bbb... " will in another line.

    elm_object_text_set(ad->label,
            "<font_size=44><color=#ff00FF>aaaaaaaaaa<br>bbbbanaaaaaaaaaaaaaa</br></color></font_size>");

Jean Yang

Just add one tip, if you want to show different size and color for 2 line content, use <font_size=44><color=#ff00FF>to include the these 2 line, like below:

"<font_size=44><color=#ff00FF>aaaaaaaaaa</color></font_size><font_size=22><color=#ff0000><br>bbbbanaaaaaaaaaaaaaa</br></color></font_size>"

Vikram

I dont find a way to let the text wraped automatically according to the content length for a text part in edje.

But, I think you can use a swallow part with label as a workaround, the set text wrap for lable as the sample code:

   elm_object_text_set(label,"<wrap = word>Clicking on the button below closes the application.</wrap>");

Possible wrap option is: word, char, mixed, or none.

Mark as answer
Jin Yoon

The TEXT part you've used in your edc doesn't support 'multiline'.

I think you need to change your part to 'TEXTBLOCK'.

And the height of the TEXTBLOCK has to be set the height of 2 lines.

Please check below codes.

 

    style {
        name: "notibox_info";
        base: "font=Tizen:style=Regular text_class=tizen font_size=28 color=#F8F6EF7F ellipsis=1.0 linegap=-6 wrap=mixed";
    }

/* some parts */

        part {
            name: "object.text.info.1.multiline";
            scale: 1;
            type: TEXTBLOCK;
            multiline: 1;
            description {
                state: "default" 0.0; 
                align: 0.0 0.0; 
                fixed: 1 1; 
                rel1 {
                    to: "rect.text.info.1.multiline";
                }
                rel2 {
                    to: "rect.text.info.1.multiline";
                }
                text {
                        style: "notibox_info";
                        align: 0.0 0.0; 
                        fit: 0 0; 
                }
                visible:0;
            }
        }

 

Best regards, Jin.

bhoomika rathod

Hello,
I have been applied this solution but I want to change fonts of textblock text.
I am setting text from code as shown below.
 

elm_object_part_text_set(layout,"Title","Hello world!!!Here you can add your long text or description...");

my edc code is
 

fonts {
   font: "SFNewRepublic.ttf" "standard";
}

styles {
   style { "basic_style";
       base: "font="standard" font_size=18 text_class=entry color=#FFFFFF valign=center ellipsis=1.0 linegap=-6 wrap=mixed";
       // base: "font="Sans" font_size=30 text_class=entry color=#FFFFFF style=far_soft_shadow shadow_color=#FF0D11 valign=center ellipsis=1.0 wrap=none align=center";
   }
}

collections {
   base_scale: 1.0;
   group { name: "layout";

      parts {
          
         part {
            
            name: "Title";
            scale: 1;
            type: TEXTBLOCK;
            multiline: 1;
            description {

               align: 0.0 0.0; 
               fixed: 1 1; 
               color: 0 0 0 255;
               text.font: "standard";
               text {
                  
                  text: "hello";
                  font: "standard";
                  style: "basic_style";
                  size: 20;
                  align: 0.0 0.0; 
                  fit: 0 0; 
               }
               rel1.relative: 0.00 0.25;
               rel2.relative: 1.00 0.49;
               visible:1;
            }
         }
      }
   }
}

It shows font change in edc file. But when I set text from c file, it shows default font.
plz help me out of this.

K Johnson

Did you go through the solution in this link? According to Dinal Jivani's reply he could successfully change font of text.