View 我的照片不';我的设备屏幕上不会显示

View 我的照片不';我的设备屏幕上不会显示,view,image,View,Image,你好, 我的设备有问题。我创建了一个布局。它可以与仿真器配合使用。但是当我将项目导出到我的GS3时,图像视图就消失了 我能做什么?我尝试删除按钮,以查看图片是否显示但不起作用。 我的图片是png格式的 多谢各位 //Obtenir les dimensions de l'écran Display display = getWindowManager().getDefaultDisplay(); int largeur = display.getWidth();

你好,

我的设备有问题。我创建了一个布局。它可以与仿真器配合使用。但是当我将项目导出到我的GS3时,图像视图就消失了

我能做什么?我尝试删除按钮,以查看图片是否显示但不起作用。

我的图片是png格式的

多谢各位

    //Obtenir les dimensions de l'écran
    Display display = getWindowManager().getDefaultDisplay();

    int largeur = display.getWidth();
    int hauteur= display.getHeight();
    int orientation = display.getOrientation();

    if (orientation==1 || orientation==3)
    {
        LinearLayout accueil = new LinearLayout(this);// création de la page d'accueil sans passer par les xml
        accueil.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        accueil.setBackgroundColor(0xFF6E2524);
        accueil.setOrientation(LinearLayout.VERTICAL);

        TextView title = new TextView(this);//creation du titre
        LayoutParams lparams1 = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        title.setLayoutParams(lparams1);//fixer largeur hauteur
        title.setGravity(Gravity.CENTER);
        title.setTextColor(0xFFFFFFFF);
        title.setText("Toucher pour créer");
        title.setTextSize(TypedValue.COMPLEX_UNIT_PX, hauteur*8/100);//réglage pour adapter le texte à la taille de l'écran
        accueil.addView(title); // ajout au layout principal


        Button b1 = new Button(this);
        LinearLayout.LayoutParams lparams2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        lparams2.setMargins(largeur/8, hauteur/18, largeur/8, 0); //fixe les marges
        b1.setLayoutParams(lparams2);//fixer largeur hauteur
        b1.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
        b1.setBackgroundColor(0xFFB7C025);
        b1.setGravity(Gravity.CENTER);
        b1.setTextColor(0xFFFFFFFF);
        b1.setText("Galerie des oeuvres");
        b1.setTextSize(TypedValue.COMPLEX_UNIT_PX, hauteur*5/100);//réglage pour adapter le texte à la taille de l'écran
        accueil.addView(b1); // ajout au layout principal


        Button b2 = new Button(this);
        LinearLayout.LayoutParams lparams3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        lparams3.setMargins(largeur/8, hauteur/18, largeur/8, 0); //fixe les marges
        b2.setLayoutParams(lparams3);//fixer largeur hauteur
        b2.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
        b2.setBackgroundColor(0xFFB7C025);
        b2.setGravity(Gravity.CENTER);
        b2.setTextColor(0xFFFFFFFF);
        b2.setText("Prise en main");
        b2.setTextSize(TypedValue.COMPLEX_UNIT_PX, hauteur*5/100);//réglage pour adapter le texte à la taille de l'écran
        accueil.addView(b2); // ajout au layout principal


        Button b3 = new Button(this);
        LinearLayout.LayoutParams lparams4 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        lparams4.setMargins(largeur/8, hauteur/18, largeur/8, 0); //fixe les marges
        b3.setLayoutParams(lparams4);//fixer largeur hauteur
        b3.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
        b3.setBackgroundColor(0xFFB7C025);
        b3.setGravity(Gravity.CENTER);
        b3.setTextColor(0xFFFFFFFF);
        b3.setText("Quitter");
        b3.setTextSize(TypedValue.COMPLEX_UNIT_PX, hauteur*5/100);//réglage pour adapter le texte à la taille de l'écran
        accueil.addView(b3); // ajout au layout principal


        ImageView logo = new ImageView(this);
        LinearLayout.LayoutParams lparams5 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, hauteur/15);//calculer pour garder le ratio 1/2
        lparams5.setMargins(largeur/18, hauteur/18, 0, 0); //fixe les marges
        logo.setLayoutParams(lparams5);
        logo.setAdjustViewBounds(true);
        logo.setImageResource(R.drawable.logo);
        accueil.addView(logo);//ajout au layout ppl


        setContentView(accueil);//mise en place du layout accueil
    }
    else
    {
    LinearLayout accueil = new LinearLayout(this);// création de la page d'accueil sans passer par les xml
    accueil.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    accueil.setBackgroundColor(0xFF6E2524);
    accueil.setOrientation(LinearLayout.VERTICAL);

    TextView title = new TextView(this);//creation du titre
    LayoutParams lparams1 = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    title.setLayoutParams(lparams1);//fixer largeur hauteur
    title.setGravity(Gravity.CENTER);
    title.setTextColor(0xFFFFFFFF);
    title.setText("Toucher pour créer");
    title.setTextSize(TypedValue.COMPLEX_UNIT_PX, largeur*8/100);//réglage pour adapter le texte à la taille de l'écran
    accueil.addView(title); // ajout au layout principal


    Button b1 = new Button(this);
    LinearLayout.LayoutParams lparams2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lparams2.setMargins(largeur/8, hauteur/8, largeur/8, 0); //fixe les marges
    b1.setLayoutParams(lparams2);//fixer largeur hauteur
    b1.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
    b1.setBackgroundColor(0xFFB7C025);
    b1.setGravity(Gravity.CENTER);
    b1.setTextColor(0xFFFFFFFF);
    b1.setText("Galerie des oeuvres");
    b1.setTextSize(TypedValue.COMPLEX_UNIT_PX, largeur*6/100);//réglage pour adapter le texte à la taille de l'écran
    accueil.addView(b1); // ajout au layout principal


    Button b2 = new Button(this);
    LinearLayout.LayoutParams lparams3 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lparams3.setMargins(largeur/8, hauteur/8, largeur/8, 0); //fixe les marges
    b2.setLayoutParams(lparams3);//fixer largeur hauteur
    b2.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
    b2.setBackgroundColor(0xFFB7C025);
    b2.setGravity(Gravity.CENTER);
    b2.setTextColor(0xFFFFFFFF);
    b2.setText("Prise en main");
    b2.setTextSize(TypedValue.COMPLEX_UNIT_PX, largeur*6/100);//réglage pour adapter le texte à la taille de l'écran
    accueil.addView(b2); // ajout au layout principal


    Button b3 = new Button(this);
    LinearLayout.LayoutParams lparams4 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lparams4.setMargins(largeur/8, hauteur/8, largeur/8, 0); //fixe les marges
    b3.setLayoutParams(lparams4);//fixer largeur hauteur
    b3.setMinimumWidth(largeur*8/10);//fixe la largeur minimal 
    b3.setBackgroundColor(0xFFB7C025);
    b3.setGravity(Gravity.CENTER);
    b3.setTextColor(0xFFFFFFFF);
    b3.setText("Quitter");
    b3.setTextSize(TypedValue.COMPLEX_UNIT_PX, largeur*6/100);//réglage pour adapter le texte à la taille de l'écran
    accueil.addView(b3); // ajout au layout principal


    ImageView logo = new ImageView(this);
    LinearLayout.LayoutParams lparams5 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, hauteur/20);//calculer pour garder le ratio 1/2
    lparams5.setMargins(largeur/18, hauteur/18, 0, 0); //fixe les marges
    logo.setLayoutParams(lparams5);
    logo.setAdjustViewBounds(true);
    logo.setImageResource(R.drawable.logo);
    accueil.addView(logo);//ajout au layout ppl


    setContentView(accueil);//mise en place du layout accueil
    }