0
我有以下佈局,其中包含一個大的和小的表面視圖。我以編程方式添加了曲面視圖。我正在使用覆蓋技術將較小的預覽放在較大視圖的頂部。我想添加一個切換按鈕,但不幸的是該按鈕隱藏自身,但是當您按下屏幕時它會起作用。我較大的sufaceview繪製一個位圖,而較小的預覽顯示其他東西。以下是我的代碼:切換按鈕消失在我的Android的xml佈局
<FrameLayout 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"
tools:context="${relativePackage}.${activityClass}" >
<FrameLayout
android:id="@+id/big_preview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/small_preview"
android:layout_width="120dp"
android:layout_height="160dp"
android:layout_gravity="top|right"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp" >
</FrameLayout>
<FrameLayout
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="20dp"
android:alpha="0.5"
android:background="@android:color/white"
android:padding="10dp" >
<ToggleButton
android:id="@+id/btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/button_selector"
android:checked="true"
android:padding="10dp"
android:text=""
android:textOff=""
android:textOn="" />
</FrameLayout>
</FrameLayout>
你想在哪裏顯示切換按鈕? – iRuth 2015-03-18 21:03:14
在較大的表面視圖底部。問題是爲什麼它正在消失的人? – 2015-03-18 21:04:05