如何将捕获的IMAGE,AUDIO动态添加到水平滚动视图中 [英] how to add captured IMAGE,AUDIO dynamically into a horizontal scroll view

查看:61
本文介绍了如何将捕获的IMAGE,AUDIO动态添加到水平滚动视图中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android编程的新手,任何人都可以告诉我如何将捕获的图像和录制的音频文件动态添加到horizo​​ntalscrollview-> LINEARLAYOUT。



< horizo​​ntalscrollview>

android:id =@ + id / Horizo​​ntalScroll

android:layout_width =match_parent

android:layout_height =wrap_content

android:layout_marginBottom =8dp>



< linearlayout> android:id =@ + id / llHorizo​​ntalScroll

android:layout_width =match_parent

android:layout_height =40dp

android :orientation =horizo​​ntal>



//这里我需要添加动态创建的按钮,这些按钮应该在启动时显示





我有三个活动,即图像捕捉,录制音频和涂鸦。

*>当我点击记录时,它会录制音频并动态添加按钮视图到Linearlayout,

线性布局存在于horizo​​ntalscrollview内,其中orientation设置为Horizo​​ntal为线性布局。

* >当我点击捕获它应该捕获图像并动态添加按钮视图到线性布局等等

*>对于scribble也是同样的过程。



我能够捕获,记录活动,但无法动态地将它们添加到该线性布局。



请帮帮我,示例代码将非常感谢。

先谢谢你。

I am new to android programming,can anyone tell me how to add captured image and recorded audio files dynamically into a horizontalscrollview->LINEARLAYOUT.

<horizontalscrollview>
android:id="@+id/HorizontalScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" >

<linearlayout> android:id="@+id/llHorizontalScroll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal" >

//Here i need to add dynamically created Buttons which should show on start up


I have three activities namely Image capture,Record Audio and scribble.
*> When i click record, it will record audio and add a button view dynamically to Linearlayout,
linear layout present inside horizontalscrollview where orientation is set to Horizontal for linear layout.
*> When i click capture it should capture an image and add a button view dynamically to linear layout and so on
*> and for scribble also same process.

I am able to capture,record the activities but couldn't able to add those to that linear layout dynamically.

Please help me out,a sample code will be really appreciated.
Thank you in Advance.

推荐答案

如果我理解你的问题,那么这段代码可能会有所帮助



If I am Understanding your problem well, then this code could be helpfull

LinearLayout linearLayout = (LinearLayout)inflater.inflate(R.layout.news_categories_item, null);

Button b1 = (Button)linearLayout.findViewById(R.id.button1);

linearLayout.addView(b1);


这篇关于如何将捕获的IMAGE,AUDIO动态添加到水平滚动视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆