0

レイヤーがあり、透明です。ボタンをクリックすることしかできません。レイヤーをクリックしたいです。

これが私のマニフェストです:

<activity android:name=".Test" android:theme="@style/Theme.Transparent"/>

透明テーマのスタイルは次のとおりです。

<style name="Theme.Transparent" parent="android:Theme">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">false</item>
</style>

これが私のアクティビティコードです:

import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class Test extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);

        // v I can touch through app, but cant click on button
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); 
        // ^ I can touch through app, but cant click on button

        Button xclose = (Button) findViewById(R.id.buttonx);
        xclose.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                finish();
            }
        });
    }
}

これが私のtest.xmlレイアウトです:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
    <Button android:id="@+id/buttonx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="X" />
</RelativeLayout>
4

2 に答える 2