mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app: [android] use GioView inside FrameLayout
Before that change, on Android, was impossible to overlay GioView with a custom view. This change adds FrameLayout and renders GioView into that, allowing to use addView from Android API. Fixes: https://todo.sr.ht/~eliasnaur/gio/427 Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
+17
-3
@@ -5,16 +5,30 @@ package org.gioui;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
public final class GioActivity extends Activity {
|
public final class GioActivity extends Activity {
|
||||||
private GioView view;
|
private GioView view;
|
||||||
|
public FrameLayout layer;
|
||||||
|
|
||||||
@Override public void onCreate(Bundle state) {
|
@Override public void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
|
|
||||||
this.view = new GioView(this);
|
layer = new FrameLayout(this);
|
||||||
|
view = new GioView(this);
|
||||||
|
|
||||||
setContentView(view);
|
view.setLayoutParams(new FrameLayout.LayoutParams(
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT
|
||||||
|
));
|
||||||
|
view.setFocusable(true);
|
||||||
|
view.setFocusableInTouchMode(true);
|
||||||
|
|
||||||
|
layer.addView(view);
|
||||||
|
setContentView(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onDestroy() {
|
@Override public void onDestroy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user