一个快速高效的Android开源图像加载库,它将媒体解码,内存和磁盘缓存以及资源池包装成一个简单易用的界面。
如何使用 Glide Android 加载带有“content://”前缀的 URI?
我正在尝试使用 Glide 加载 URI“content://com.android.contacts/contacts/295”的联系人照片。 当我使用 Glide.with(context).load(Uri.parse(contactPhoto).into(imageview) 滑翔给出...
由于图像格式未知,Coil、Fresco 和 Glide 无法解码 jpeg 图像
我尝试在 Jetpack Compose 中使用 Coil、Glide 和 Fresco 来加载和显示图像,但由于解码而出现错误 首先我检查了 Coil 并得到了下一个错误: java.lang.IllegalStateException: BitmapFa...
我正在开发一个应用程序,在 viewpager 中有 2 个片段。在第二个片段中,我使用 recyclerview 将图像加载到其中。我面临的问题是关于 UI 阻塞。当我启动...
如何从缓存中预加载图像格式,并稍后使用 Coil/Glide 通过 UID 从缓存中获取它
也就是说我在数据层有一个来自服务器的数据类 数据类 AvatarPreload( val base64:字符串, 有效值:长 ) 然后我想将它保存到我的磁盘/内存中,因为 View la...
我尝试以这种方式显示本地视频缩略图,它确实在列表中显示了缩略图。然而,该列表变得非常难以滚动。 有更好的方法来解决问题吗? https://
像 Amazon prime 这样的电影应用程序,我会使用 CategoryItem 显示电影类别。我想用Recycler显示所有类别
我把事情搞混了。我遇到的最初错误是 MainActivity.java:130: error: incomplete types: List无法转换为List 我把事情搞混了。我遇到的最初错误是这个 MainActivity.java:130: error: incomplete types: List can be conversion to List allCategoryList.add(new AllCategory(1,"VIP Hour", homeCatListItem1)); 当尝试修复它时,事情开始变得混乱。所以我仍然有这个错误 主要活动 import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager.widget.ViewPager; import android.os.Bundle; import com.google.android.material.tabs.TabLayout; import com.kuroniczstudio.splashscreen.adapter.BannerMoviesPagerAdapter; import com.kuroniczstudio.splashscreen.adapter.MainRecyclerAdapter; import com.kuroniczstudio.splashscreen.model.AllCategory; import com.kuroniczstudio.splashscreen.model.BannerMovies; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends AppCompatActivity { BannerMoviesPagerAdapter bannerMoviesPagerAdapter; TabLayout indicatorTab, categoryTab; ViewPager bannerMoviesViewPager; List<BannerMovies> homeBannerList; List<BannerMovies> vipHourBannerList; List<BannerMovies> prophecyBannerList; List<BannerMovies> testimonyBannerList; Timer sliderTimer; MainRecyclerAdapter mainRecyclerAdapter; RecyclerView mainRecycler; List<AllCategory> allCategoryList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); indicatorTab = findViewById(R.id.tab_indicator); categoryTab = findViewById(R.id.tablayout); homeBannerList = new ArrayList<>(); homeBannerList.add(new BannerMovies(1, "Trailer - I cannot give up now!!!", "https://i.pinimg.com/originals/1a/5e/c6/1a5ec63c50513055ac7674ad65c2e1a1.jpg", "https://youtu.be/7w1YKrHW85c")); homeBannerList.add(new BannerMovies(2, "Trailer - I must cross the Red Sea", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/88dHJdCyyBA")); homeBannerList.add(new BannerMovies(3, "Trailer - I must be better than my Father", "https://i.pinimg.com/originals/ec/60/46/ec604668771e8916466be6835d2ea588.jpg", "https://youtu.be/GsNrJgLSTAM")); vipHourBannerList = new ArrayList<>(); vipHourBannerList.add(new BannerMovies(1, "I will be better than my father", "https://i.pinimg.com/originals/ec/60/46/ec604668771e8916466be6835d2ea588.jpg", "https://youtu.be/ymIUteex694")); vipHourBannerList.add(new BannerMovies(3, "I must cross the Red Sea", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/Sbbu536E9vA")); vipHourBannerList.add(new BannerMovies(4, "My Hair Will Grow Again", "https://img.yts.mx/assets/images/movies/sharkula_2022/medium-cover.jpg", "https://youtu.be/yau5eQH1K_I")); prophecyBannerList = new ArrayList<>(); prophecyBannerList.add(new BannerMovies(2, "Looking for Jackie", "https://img.yts.mx/assets/images/movies/looking_for_jackie_2009/medium-cover.jpg", "https://www.youtube.com/watch?v=ByYWL1SEe-k")); prophecyBannerList.add(new BannerMovies(3, "Khuda Haafiz Chapter II", "https://sdmoviespoint.mba/wp-content/uploads/2022/07/Khuda-Haafiz-Chapter-II-Agni-Pariksha-2022-Full-Movie-Download-Free.jpg", "https://www.youtube.com/watch?v=ByYWL1SEe-k")); prophecyBannerList.add(new BannerMovies(4, "Sharkula", "https://img.yts.mx/assets/images/movies/sharkula_2022/medium-cover.jpg", "https://youtu.be/6SOEYXZK6Q4")); prophecyBannerList.add(new BannerMovies(5, "Looking for Jackie", "https://img.yts.mx/assets/images/movies/looking_for_jackie_2009/medium-cover.jpg", "https://www.youtube.com/watch?v=ByYWL1SEe-k")); testimonyBannerList = new ArrayList<>(); testimonyBannerList.add(new BannerMovies(1, "See how this little boy survived under the water for 2 hours", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/rRFkBLGQIs8")); testimonyBannerList.add(new BannerMovies(2, "Testimony Blessing Nsikak Saved from spiritual attack", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/TdYn24MdD1Q")); testimonyBannerList.add(new BannerMovies(3, "See how this man got back his transformer working again", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/HNjxxk3eWKk")); //this is default tab selected setBannerMoviesPagerAdapter(homeBannerList); categoryTab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { switch (tab.getPosition()){ case 1: setBannerMoviesPagerAdapter(vipHourBannerList); return; case 2: setBannerMoviesPagerAdapter(prophecyBannerList); return; case 3: setBannerMoviesPagerAdapter(testimonyBannerList); return; default: setBannerMoviesPagerAdapter(homeBannerList); } } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); List<CategoryItem> homeCatListItem1 = new ArrayList<>(); homeCatListItem1.add(new CategoryItem(1, "Trailer - I cannot give up now!!!", "https://i.pinimg.com/originals/1a/5e/c6/1a5ec63c50513055ac7674ad65c2e1a1.jpg", "https://youtu.be/7w1YKrHW85c")); homeCatListItem1.add(new CategoryItem(2, "Trailer - I must cross the Red Sea", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/88dHJdCyyBA")); homeCatListItem1.add(new CategoryItem(3, "Trailer - I must be better than my Father", "https://i.pinimg.com/originals/ec/60/46/ec604668771e8916466be6835d2ea588.jpg", "https://youtu.be/GsNrJgLSTAM")); homeCatListItem1.add(new CategoryItem(4, "My Hair Will Grow Again", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/yau5eQH1K_I")); homeCatListItem1.add(new CategoryItem(5, "See how this man got back his transformer working again", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/HNjxxk3eWKk")); List<CategoryItem> homeCatListItem2 = new ArrayList<>(); homeCatListItem2.add(new CategoryItem(1, "Trailer - I cannot give up now!!!", "https://i.pinimg.com/originals/1a/5e/c6/1a5ec63c50513055ac7674ad65c2e1a1.jpg", "https://youtu.be/7w1YKrHW85c")); homeCatListItem2.add(new CategoryItem(2, "Trailer - I must cross the Red Sea", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/88dHJdCyyBA")); homeCatListItem2.add(new CategoryItem(3, "Trailer - I must be better than my Father", "https://i.pinimg.com/originals/ec/60/46/ec604668771e8916466be6835d2ea588.jpg", "https://youtu.be/GsNrJgLSTAM")); homeCatListItem2.add(new CategoryItem(4, "My Hair Will Grow Again", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/yau5eQH1K_I")); homeCatListItem2.add(new CategoryItem(5, "See how this man got back his transformer working again", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/HNjxxk3eWKk")); List<CategoryItem> homeCatListItem3 = new ArrayList<>(); homeCatListItem3.add(new CategoryItem(1, "Trailer - I cannot give up now!!!", "https://i.pinimg.com/originals/1a/5e/c6/1a5ec63c50513055ac7674ad65c2e1a1.jpg", "https://youtu.be/7w1YKrHW85c")); homeCatListItem3.add(new CategoryItem(2, "Trailer - I must cross the Red Sea", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/88dHJdCyyBA")); homeCatListItem3.add(new CategoryItem(3, "Trailer - I must be better than my Father", "https://i.pinimg.com/originals/ec/60/46/ec604668771e8916466be6835d2ea588.jpg", "https://youtu.be/GsNrJgLSTAM")); homeCatListItem3.add(new CategoryItem(4, "My Hair Will Grow Again", "https://i.pinimg.com/originals/14/f1/5c/14f15cc3bbc780abdfecafa0f94024e1.jpg", "https://youtu.be/yau5eQH1K_I")); homeCatListItem3.add(new CategoryItem(5, "See how this man got back his transformer working again", "https://i.pinimg.com/originals/7f/8f/02/7f8f02fdfc2b09de9d01d86395d128b1.jpg", "https://youtu.be/HNjxxk3eWKk")); allCategoryList = new ArrayList<>(); allCategoryList.add(new AllCategory(1,"VIP Hour", homeCatListItem1)); allCategoryList.add(new AllCategory(2,"VIP Hour", homeCatListItem2)); allCategoryList.add(new AllCategory(3,"VIP Hour", homeCatListItem3)); setMainRecycler(allCategoryList); } private void setBannerMoviesPagerAdapter(List<BannerMovies> bannerMoviesList) { bannerMoviesViewPager = findViewById(R.id.banner_viewPager); bannerMoviesPagerAdapter = new BannerMoviesPagerAdapter(this, bannerMoviesList); bannerMoviesViewPager.setAdapter(bannerMoviesPagerAdapter); indicatorTab.setupWithViewPager(bannerMoviesViewPager); sliderTimer = new Timer(); sliderTimer.scheduleAtFixedRate(new AutoSlider(), 4000, 6000); indicatorTab.setupWithViewPager(bannerMoviesViewPager, true); } class AutoSlider extends TimerTask { @Override public void run() { MainActivity.this.runOnUiThread(() ->{ if (bannerMoviesViewPager.getCurrentItem() < homeBannerList.size() - 1) { bannerMoviesViewPager.setCurrentItem(bannerMoviesViewPager.getCurrentItem() + 1); } else{ bannerMoviesViewPager.setCurrentItem(0); } }); } } public void setMainRecycler(List<AllCategory> allCategoryList) { mainRecycler = findViewById(R.id.main_recycler); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this, RecyclerView.VERTICAL, false); mainRecycler.setLayoutManager(layoutManager); mainRecyclerAdapter = new MainRecyclerAdapter(this, allCategoryList); mainRecycler.setAdapter(mainRecyclerAdapter); } } //模型目录中的项目// 类别项目 public class CategoryItem { Integer id; String movieName; String imageUrl; String fileUrl; public CategoryItem(Integer id, String movieName, String imageUrl, String fileUrl) { this.id = id; this.movieName = movieName; this.imageUrl = imageUrl; this.fileUrl = fileUrl; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getMovieName() { return movieName; } public void setMovieName(String movieName) { this.movieName = movieName; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getFileUrl() { return fileUrl; } public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } } 所有类别.Class import java.util.List; public class AllCategory { String categoryTitle; Integer categoryId; private List<CategoryItem> categoryItemList = null; public AllCategory(Integer categoryId, String categoryTitle, List<CategoryItem> categoryItemList) { this.categoryTitle = categoryTitle; this.categoryId = categoryId; this.categoryItemList = categoryItemList; } public List<CategoryItem> getCategoryItemList() { return categoryItemList; } public void setCategoryItemList(List<CategoryItem> categoryItemList) { this.categoryItemList = categoryItemList; } public String getCategoryTitle(){ return categoryTitle; } public void setCategoryTitle(String categoryTitle){ this.categoryTitle = categoryTitle; } public Integer getCategoryId() { return categoryId; } public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } } 横幅电影 包 com.kuroniczstudio.splashscreen.model; 公共课 BannerMovies { Integer id; String movieName; String imageUrl; String fileUrl; public BannerMovies(Integer id, String movieName, String imageUrl, String fileUrl) { this.id = id; this.movieName = movieName; this.imageUrl = imageUrl; this.fileUrl = fileUrl; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getMovieName() { return movieName; } public void setMovieName(String movieName) { this.movieName = movieName; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getFileUrl() { return fileUrl; } public void setFileUrl(String fileUrl) { this.fileUrl = fileUrl; } } _____________________________________ **MainRecyclerAdapter** package com.kuroniczstudio.splashscreen.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.kuroniczstudio.splashscreen.CategoryItem; import com.kuroniczstudio.splashscreen.R; import com.kuroniczstudio.splashscreen.model.AllCategory; import java.util.List; public class MainRecyclerAdapter extends RecyclerView.Adapter<MainRecyclerAdapter.MainViewHolder> { Context context; List<AllCategory> allCategoryList; public MainRecyclerAdapter(Context context, List<AllCategory> allCategoryList) { this.context = context; this.allCategoryList = allCategoryList; } @NonNull @Override public MainViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new MainViewHolder(LayoutInflater.from(context).inflate(R.layout.main_recycler_row_item, parent)); } @Override public void onBindViewHolder(@NonNull MainViewHolder holder, int position) { holder.categoryName.setText(allCategoryList.get(position).getCategoryTitle()); } @Override public int getItemCount() { return allCategoryList.size(); } public static final class MainViewHolder extends RecyclerView.ViewHolder{ TextView categoryName; RecyclerView itemRecycler; public MainViewHolder(@NonNull View itemView) { super(itemView); categoryName = itemView.findViewById(R.id.item_category); itemRecycler = itemView.findViewById(R.id.item_recycler); } } private void setItemRecycler(RecyclerView recyclerView, List<CategoryItem> categoryItemList){ ItemRecyclerAdapter itemRecyclerAdapter = new ItemRecyclerAdapter(context, categoryItemList); recyclerView.setLayoutManager(new LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)); recyclerView.setAdapter(itemRecyclerAdapter); } } ItemRecyclerAdapter package com.kuroniczstudio.splashscreen.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.kuroniczstudio.splashscreen.CategoryItem; import com.kuroniczstudio.splashscreen.R; import java.util.List; public class ItemRecyclerAdapter extends RecyclerView.Adapter<ItemRecyclerAdapter.ItemViewHolder> { Context context; List<CategoryItem> categoryItemList; public ItemRecyclerAdapter(Context context, List<CategoryItem> categoryItemList) { this.context = context; this.categoryItemList = categoryItemList; } @NonNull @Override public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new ItemViewHolder(LayoutInflater.from(context).inflate(R.layout.cat_recycler_row_items,parent, false)); } @Override public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) { Glide.with(context).load(categoryItemList.get(position).getImageUrl()).into(holder.itemImage); } @Override public int getItemCount() { return categoryItemList.size(); } public static final class ItemViewHolder extends RecyclerView.ViewHolder{ ImageView itemImage; public ItemViewHolder(@NonNull View itemView) { super(itemView); itemImage = itemView.findViewById(R.id.item_image); } } } BannerMoviesPagerAdapter package com.kuroniczstudio.splashscreen.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.viewpager.widget.PagerAdapter; import com.bumptech.glide.Glide; import com.kuroniczstudio.splashscreen.R; import com.kuroniczstudio.splashscreen.model.BannerMovies; import java.util.List; public class BannerMoviesPagerAdapter extends PagerAdapter { Context context; List<BannerMovies> bannerMoviesList; public BannerMoviesPagerAdapter(Context context, List<BannerMovies> bannerMoviesList) { this.context = context; this.bannerMoviesList = bannerMoviesList; } @Override public int getCount() { return bannerMoviesList.size(); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object object) { return view == object; } @Override public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { container.removeView((View) object); } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { View view = LayoutInflater.from(context).inflate(R.layout.banner_movie_layout, null); ImageView bannerImage = view.findViewById(R.id.banner_image); Glide.with(context).load(bannerMoviesList.get(position).getImageUrl()).into(bannerImage); container.addView(view); return view; } } 错误本身就告诉你哪里搞砸了。您的项目中有 2 个 CategoryItem 类,具有以下层次结构: com.kuroniczstudio.splashscreen.CategoryItem com.kuroniczstudio.splashscreen.model.CategoryItem 您试图同时使用这两种方法,从而造成了冲突。确保您只使用一个类。 在您的应用程序中,您有两个名为 CategoryItem 的类。 其中一个有全名: com.kuroniczstudio.splashscreen.CategoryItem 对方的全名: com.kuroniczstudio.splashscreen.model.CategoryItem 它们是不同的类别,您无法从一个类别转换为另一类别。 我们无法从代码中得知您向我们展示了为什么会发生这种情况。 首先,您还没有向我们展示 CategoryItem 的两个版本。 并且您遗漏了所有 package 语句。 (所以我们无法判断 CategoryItem 构造函数需要哪个版本的 AllCategory ...) 但是编译错误消息清楚地证明它正在发生。 你可能根本不应该上两门CategoryItem课程...... 免费下载最新版本的 Castle Mod APK,无广告且解锁所有功能。单击下载按钮即可开始观看电影、节目和现场板球比赛。 https://castleappk.org/
合并dex档案时出错:com.bumptech.glide.GenerateRequestManagerFactory
我向 RN 应用程序添加了本机 Android 代码,能够运行调试应用程序,但在创建发布版本时出现 mergeDex 错误。我正在使用 multidex,但仍然遇到这个问题。 实施 'com.gi...
我的 Glide 代码如下 滑行.with(这个) .load("https://flybubble.com/media/wysiwyg/images/home/mainpage-box-5L.jpg") .transition(DrawableTransitionOptions.withCross...
我正在使用 glide 在我的 android 项目中加载 gif。 Glide.with(getActivity()).load(mainDrawable).asGif().into(mainDrawableView); 这会让 gif 不断重复,如何才能阻止 gif 循环播放呢?
我正在维护一个使用 Glide 下载图像的 Android 应用程序。 除了图像之外,有时它还显示视频,并使用相同的过程来显示视频缩略图。 我注意到这个案例...
我想加载图像并在具有自定义视图的 AlertDialog 中显示它,但出现此错误: 找不到GenerateAppGlideModule。您应该包含一个 annotationProcessor 编译依赖项...
我之前已经使用过很多次 Glide,但目前我在显示具有此类 url 的图像时遇到问题 https://www.publicdomainpictures.net/pictures/10000/nahled/thinking-monkey-
我正在尝试使用 Glide 下载 jpg 文件。文件由承载者保护。我尝试了以下方法。没有不记名保护的免费图像可以按预期工作。 暂停有趣的 downloadUrlToBitmap(
我正在使用Glide,我想从一个url加载一个图像,然后从另一个url覆盖另一个图像,然后将两个叠加结果放入imageView中。 我已经调查过
我正在尝试使用 glide 将图像从 URL 加载到我的图像视图中,但它不起作用。我无法下载并显示图像。我已经在我的项目中添加了所有依赖项和权限...
意外的标记(使用“;”分隔同一行上的表达式) 这是我在尝试在我的应用程序中实现 Glide 库时遇到的错误 我也尝试使用 实施(com.
我有一个本地 SVG 文件,我想将其加载到我的图像视图中。 SVG 文件通过我们公司的集成机制提供给我的应用程序。换句话说,我无法通过...
为什么我无法在 build.gradle 中实现 glide 的依赖项
我正在尝试使用 Glide 从我的 java android 应用程序中的 url 加载图像 Glide.with(holder.itemView.getContext()) .load(newsItem.getImageUrl()) .into(holder.imageView); 格...
“如何使用GlideImage获取列表中加载成功的图片数量?”
我有一个字符串列表,我在其中存储网络图像,稍后我会在 forEach 循环中迭代这些网络图像,并且在其中,我有 GlideImage 可组合项,它允许我确定图像是否为
我知道SO上有很多类似的问题,但大多数都使用MOVIE类,该类已被弃用。现在 Android 建议对 GIF 使用 AnimatedImageDrawable 类,但是...