Android 根据seekbar位置动态添加视图
是否可以使用android中搜索栏的值向活动添加视图 例如,如果用户在搜索栏上选择并滚动到值2,则将在同一活动中加载两个较小的图像视图Android 根据seekbar位置动态添加视图,android,seekbar,Android,Seekbar,是否可以使用android中搜索栏的值向活动添加视图 例如,如果用户在搜索栏上选择并滚动到值2,则将在同一活动中加载两个较小的图像视图 非常感谢您的帮助。我一直在研究这个问题,这是我的解决方案。这可能不是完美的,所以请让我知道,如果有什么需要改进 这就是结果 1.创建一个新项目,然后重试。将图像文件保存到项目的res/drawable/目录中 2.打开res/layout/activity\u main.xml文件并插入以下内容: 活动\u main.xml <?xml version="
非常感谢您的帮助。我一直在研究这个问题,这是我的解决方案。这可能不是完美的,所以请让我知道,如果有什么需要改进 这就是结果 1.创建一个新项目,然后重试。将图像文件保存到项目的
res/drawable/
目录中
2.打开res/layout/activity\u main.xml文件并插入以下内容:
活动\u main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:max="10" />
</LinearLayout>
</ScrollView>
感谢:
我一直在研究这个问题,这是我的解决方案。这可能不是完美的,所以请让我知道,如果有什么需要改进
这就是结果
1.创建一个新项目,然后重试。将图像文件保存到项目的
res/drawable/
目录中
2.打开res/layout/activity\u main.xml文件并插入以下内容:
活动\u main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:max="10" />
</LinearLayout>
</ScrollView>
感谢:
我想是的。你试了什么?我还没试过呢,那只是个想法。我在想一些关于使用公共空间的事情:改变了(SeekBar SeekBar,int progress,boolean fromUser,特别是可能调用额外imageview的进度值。我只是不确定如何确保图像视图正确排列并使其实际工作。请查看有关如何操作的答案。我认为您可以使用GridView并根据该值设置其行数或列数。还有c见鬼。@Brummery用搜索栏和listview创建一个布局,用图像视图创建listview项目,当用户滚动并选择任何值,在适配器和bingo中插入一些对象时,你会得到那么多的图像视图。我想是的。你尝试了什么?我还没有尝试过任何东西。这只是一个想法。我一直在想使用:public void onProgressChanged(SeekBar SeekBar,int progress,boolean fromUser,特别是可能调用额外imageview的进度值。我只是不确定如何确保图像视图正确排列并使其实际工作。请查看有关如何操作的答案。我认为您可以使用GridView并根据该值设置其行数或列数。还有c见鬼。@Brummery用搜索栏和listview创建一个布局,用图像视图创建listview项目,当用户滚动并选择任何值,在适配器和bingo中插入一些对象时,你会得到那么多的图像视图。这可能不是你要找的解决方案,但我认为它提供了一个很好的起点。这可能不是问题所在你们正在寻找的解决方案,但我认为它提供了一个很好的起点。