【发布时间】:2015-11-21 04:07:25
【问题描述】:
所以我正在尝试制作类似于 snapchat 如何在您向下滑动的选项菜单中进行的操作,您仍然可以在后台看到相机。我不会发布所有代码,但我已经调试了导致问题的原因。我是android dev的菜鸟,但我以前做过一些java编程。
这是我的xml
<me.dontenvy.videotest.MainMenu xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="vertical"
android:animateLayoutChanges="true"
android:id="@+id/main_menu">
<!-- this is for the camera -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/camera_container">
<TextureView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/texture"
android:animateLayoutChanges="true"/>
</RelativeLayout>
<!-- this is for the overlay menu -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slide_menu"
android:animateLayoutChanges="true"
android:background="@drawable/transparent_background">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/clear_background"
android:layout_alignParentBottom="true"
android:id="@+id/slide_button"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:layout_width="@dimen/circle_nav_button_diameter"
android:layout_height="@dimen/circle_nav_button_diameter"
android:background="@drawable/circle_button"
android:backgroundTint="#050"
android:id="@+id/take_image_nav_button"/>
</LinearLayout>
</RelativeLayout>
</me.dontenvy.videotest.MainMenu>
我在扩展RelativeLayout 的MainMenu.java 类中添加了onClick 侦听器。这是其余代码的要点https://gist.github.com/colmex/1bd19dd2cfc400b2f870
问题是当@id/take_image_nav_button 在LinearLayout 中时,onClick 动作不起作用,当我将它从LinearLayout 中取出时,onClick 动作起作用。感觉就像 LinearLayout 以某种方式阻止了点击。我已经尝试了很多我在 stackoverflow 和其他谷歌搜索上发现的东西,但似乎没有任何东西可以解决它。
【问题讨论】:
-
你能添加你的主要代码的相关部分吗?
标签: java android android-layout android-button