1
我有一个表面视图,即时将照相机预览放到上面。最重要的是,我有个亲戚的布局,有一堆的意见,像扫描按钮等将Android视图设置为不可见/不工作
我试图让这些视图无形一个,这样
myIcon.setVisibility(View.INVISIBLE);
我也试过
myIcon.setVisibility(View.GONE);
这两个似乎都没有工作。隐形根本不起作用,并且GONE 作品
在这里你可以看到一个2D图标,一个设置按钮。隐藏之前,它看起来像这样:
然后我打电话setVisibility(View.GONE)
你可以清楚地看到,它是保存给予回应这些意见的LinearLayout设置按钮更多的空间,但它并没有从它后面移除2D。我认为它与SurfaceView有关,因为我知道这通常会起作用。
我已经试过
myIcon.requestFocus();
我做能见度的变化,但仍然一无所获之后。
有什么建议吗?如果你有这方面的问题
编辑一些经验请只回应: 这里是我的布局:
<RelativeLayout 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" >
<com.sample.SampleJavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:id="@+id/cv_surface_view" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">
<ImageView
android:id="@+id/myIcon"
android:layout_width="30dip"
android:layout_height="30dip"
android:src="@drawable/twod_icon"
/>
<ImageButton
android:id="@+id/settingsBtn"
android:layout_width="30dip"
android:layout_height="30dip"
android:src="@drawable/settings_gear"
android:background="@null"
/>
</LinearLayout>
<ImageButton
android:id="@+id/scan_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo_small"
android:background="@drawable/blue_radial_grad"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:padding="20dip"
/>
在这里你可以看到图像即时通讯试图隐藏被包裹在一个线性布局。该surfaceview是在顶部,它是一个SurfaceView
请张贴相关的XML布局和/或Java代码,我看到什么是在图片发生,但它不可能猜测为什么没有更多的细节。 – Sam 2013-03-06 16:43:36
请发布一部分代码和xml – 2013-03-06 16:46:38
好吧,我发布了布局。我的活动是巨大的,并且由于OpenCV包装SurfaceView的东西,没有太多其他相关的java代码 – Jameo 2013-03-06 16:48:10