无法在Android上显示应用程序的全屏幕
问题描述:
我在我的活动中创建一个图像,然后显示它。但图像并不是全屏,因为它周围有一个白色边框!屏幕应该同时显示图像和闪光。这是我的Java代码:无法在Android上显示应用程序的全屏幕
public class DisplayData extends Activity {
float minBright = 0;
int patch = 25;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// super.onCreate(savedInstanceState);// no need to write another
//time//
setContentView(R.layout.activity_display);
ViewFlipper imageFlipper = (ViewFlipper)findViewById(R.id.image_flipper);
//I removed the irrelevant part of the code
ImageView image = new ImageView (getApplicationContext());
image.setImageBitmap(GridBitmap);
imageFlipper.addView(image);
imageFlipper.setFlipInterval(2000);
imageFlipper.startFlipping();
Thread thread = new Thread(){
@Override
public void run() {
while (true) {
try {
synchronized (this) {
wait(bl1);
runOnUiThread(new Runnable() {
@Override
public void run() {
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = maxBright;
getWindow().setAttributes(layout);
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
synchronized (this) {
wait(wh1);
runOnUiThread(new Runnable() {
@Override
public void run() {
WindowManager.LayoutParams layout = getWindow().getAttributes();
layout.screenBrightness = minBright;
getWindow().setAttributes(layout);
}
});
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
};
thread.start();
}
}
这里是XML文件(这只是一个活动,该应用程序包含另一个):
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ViewFlipper
android:id="@+id/image_flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ViewFlipper>
</RelativeLayout>
答
刚刚从取出填充你的版式:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" tools:context=".MainActivity">
<ViewFlipper
android:id="@+id/image_flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ViewFlipper>
</RelativeLayout>
分享你的xml文件 –