任何人都可以告诉我如何解决这个问题,占位符和错误

时间:2018-05-22 00:32:19

标签: android

 super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    ImageView ImageMenuUtama = (ImageView) findViewById(R.id.backgroundDpn);
    Picasso.with(this).load( "http://cloudofoasis.com/api/Ivan/Gambar/bkgutama.jpg")
            .placeholder(R.drawable.placeholder)
            .fit()
            .error(R.drawable.error)
            .into(ImageMenuUtama);

}

此图片显示代码错误 占位符(R.drawable.placeholder)和错误(R.drawable.error):

placeholder(R.drawable.placeholder) and error(R.drawable.error)

1 个答案:

答案 0 :(得分:0)

您必须在可绘制文件夹中添加名称为“占位符”和“错误”的图像

添加可绘制的步骤

  1. 从计算机复制图像
  2. 右键单击drawable文件夹,然后单击粘贴

    drawable folder

  3. 选择可绘制目录

    drawable directory

  4. 将其命名为“占位符”,然后单击“确定”

    give it name