【问题标题】:Anyone can tell me how to fix this, place holder, and error [duplicate]任何人都可以告诉我如何解决这个问题,占位符和错误[重复]
【发布时间】:2018-10-31 15:54:13
【问题描述】:
 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):

【问题讨论】:

  • 您的placeholderdrawable 目录中吗?你确定
  • 您遇到了什么错误?显示正确的错误
  • @bardao : 我是新手,你是什么意思?
  • @VicJordan : 看看上面链接中的图片,抱歉英语不好
  • 在项目资源管理器中打开res文件夹并展开所有子文件夹drawablelayoutmenu...并检查您的placeholder在哪里。 R.drwawable.palceholder 表示 placeholderres/drawable 目录中。对R.drawable.error做同样的事情

标签: android


【解决方案1】:

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

添加绘图的步骤

  1. 从您的计算机复制图像
  2. 在drawable文件夹上点击右键,点击粘贴

  3. 选择可绘制目录

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

【讨论】:

  • 谢谢你。立即尝试
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-01-16
  • 2022-07-07
  • 2016-09-19
  • 1970-01-01
相关资源
最近更新 更多