I create an image in my activity and then I display it. But the image is not full screen as there is a white border around it ! The screen is supposed to display the image and flash at the same time. Here is my Java code:
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();
}
}
Here is the XML file (This is only one activity, the application contains another one ):
<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>
Just remove the padding from your layout :
<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>