Tôi đang làm việc trên một giao diện người dùng đặc biệt trong Android -Sandwich loại, một GalleryView nhỏ trên GLSurfaceView (với các khu vực minh bạch) trên đầu trang Xem nền (LinearLayout + một số tiện ích). Đây là cách tôi nghĩ đến việc cài đặt nó lên:Cách thêm GLSurfaceView giữa Chế độ xem Android?
<User>
TOP Xem
--- GalleryView
|
--- GLSurfaceView (với các khu vực trong suốt)
|
--- LinearLayout (với widget)
BOTTOM Xem
Trong chế độ bình thường GLSurfaceView có nền màu đen trên vùng trong suốt, vì vậy tôi không thể nhìn thấy lớp dưới cùng, nhưng khi tôi sử dụng setZOrderOnTop (true); Tôi có thể nhìn thấy lớp dưới cùng, nhưng lớp trên cùng (gallery) cũng đi phía sau khung nhìn Glsurface. Làm thế nào tôi có thể thực hiện các giao diện mong muốn như trong lược đồ?
mã XML giả Ví dụ (với AnalogClock thay vì GalleryView):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#920000"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right" >
<AnalogClock
android:id="@+id/analogClock2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.test.CustomGlView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gl_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<AnalogClock
android:id="@+id/Gallery_dummyview"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Tôi không nhận được chính xác những gì bạn muốn từ chúng tôi? Bạn có muốn trợ giúp bằng cách viết bố cục XML không? –
Tôi nghĩ rằng vấn đề không có trong bố trí nhưng trong cài đặt GLSurfaceView. Theo mặc định nó không hiển thị khu vực trong suốt cho dù tôi làm gì, cho đến khi tôi không setZOrderOnTop (true) ;, nhưng thiết lập này đặt bề mặt tất cả các cách trên ... để có bố cục tương tự và có vùng trong suốt Glsurfaceview? – prot0n