Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codenameone 与创建的TTF字体垂直对齐_Codenameone - Fatal编程技术网

Codenameone 与创建的TTF字体垂直对齐

Codenameone 与创建的TTF字体垂直对齐,codenameone,Codenameone,在Android上(在模拟器或IOS中工作正常),当在标签上使用创建的TTF字体(来自文件)时,不要将图标与字体垂直对齐,字体位于顶部。当我使用本机字体时,效果很好 从屏幕截图上可以看出,IOS和Simulator上的Valign位于标签和选择器的中心,而Android上的Valign位于顶部,这在所有组件中都取得了成功 package test.kandy; import com.codename1.ui.Display; import com.codename1.ui.Font; impo

在Android上(在模拟器或IOS中工作正常),当在标签上使用创建的TTF字体(来自文件)时,不要将图标与字体垂直对齐,字体位于顶部。当我使用本机字体时,效果很好

从屏幕截图上可以看出,IOS和Simulator上的Valign位于标签和选择器的中心,而Android上的Valign位于顶部,这在所有组件中都取得了成功

package test.kandy;

import com.codename1.ui.Display;
import com.codename1.ui.Font;
import com.codename1.ui.FontImage;
import com.codename1.ui.Form;
import com.codename1.ui.Label;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.plaf.Style;
import com.codename1.ui.spinner.Picker;

public class ShaiForm extends Form {

    private Form previous;

    public ShaiForm() {

        setLayout(new BoxLayout(BoxLayout.Y_AXIS));

        int fontSize = Display.getInstance().convertToPixels(3);
        Font appFont = Font.createTrueTypeFont("Suisse Int'l", "Suisse Int'l.ttf" ).derive(fontSize, Font.STYLE_PLAIN);;

        FontImage fntImage = FontImage.createFixed("\uE161", FontImage.getMaterialDesignFont(), 0x0, 100, 100);

        Label labelCustomTTF =  new Label ("custom TTF");
        Style labelStyle = labelCustomTTF.getAllStyles();
        labelStyle.setFont(appFont);
        labelCustomTTF.setIcon(fntImage);

        Label labelNative =  new Label ("native Font");
        labelNative.setIcon(fntImage);

        Picker stringPickerCustom = new Picker();
        Style pickerStyle = stringPickerCustom.getAllStyles();
        pickerStyle.setFont(appFont);
        stringPickerCustom.setType(Display.PICKER_TYPE_STRINGS);
        stringPickerCustom.setStrings("custom TTF Font");
        stringPickerCustom.setText("custom TTF Font");

        Picker stringPickerNative = new Picker();
        stringPickerNative.setType(Display.PICKER_TYPE_STRINGS);
        stringPickerNative.setStrings("native Font");
        stringPickerNative.setText("native Font");

        add(labelCustomTTF);
        add(labelNative);       
        add(stringPickerCustom);
        add(stringPickerNative);

    }

    public void show() {
        previous = Display.getInstance().getCurrent();
        super.show();
    }

    public void goBack(){
        previous.showBack();
    }

}


我建议在问题跟踪程序中归档并发布:使用此信息。发布:该错误由代号团队修复。我建议在问题跟踪器中归档和发布:使用此信息。发布:该错误由代号团队修复。