android - 图层列表隐藏项目
问题描述
我有一个包含两个可绘制对象的图层列表(以后应该会更多)。我想隐藏所有可绘制对象并使用按钮分别激活每一个。我找不到隐藏图层列表中的项目的方法。
家庭片段
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
public static ImageView imageView;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
new ViewModelProvider(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
imageView = root.findViewById(R.id.imageView);
imageView.setImageDrawable(getResources().getDrawable(R.drawable.layerlistimage));
return root;
}
}
imageView.setImageDrawable(getResources().getDrawable(R.drawable.layerlistimage));
图层列表图像
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/gruppe_2958"/>
<item android:drawable="@drawable/gekaufteplfanze" />
</layer-list>
解决方案
推荐阅读
- python-3.x - 使用 sklearn 在 python 中进行标签和 Onehottencodeing
- php - 单击单选按钮的标签时下拉菜单消失
- c# - 将数据从自定义渲染器传递到自定义控件
- angular - Ionic Mobile 应用程序导航到外部 url
- ios - 快速禁用表格视图单元格中的滑动操作
- pandas - 如何合并熊猫中的重复行?
- php - Laravel 上不稳定的附加功能
- python - 条件列创建 DF Pandas
- java - checkSelfPermission 和 shouldShowRequestPermissionRationale 有什么区别?
- java - 64位java可以和32位tomcat一起使用吗