Question: Let say I have 2 forms in my app. let say loginForm and mainForm. In loginForm allows the user to enter his/her username and password then goes to mainForm. From mainForm is I click the back button it will go back to loginForm and now my **issue** is from loginForm if I will click back button it goes again to mainForm without logging in.

What is the best to make this correct?

**loginForm**

```
EditText edtU = (EditText) findViewById (R.id.txtU);
EditText edtP = (EditText) findViewById (R.id.txtP);
Button btnLogin = (Button) findViewById (R.id.btLog);
btnLogin.setOnclickListener(new OnclickListener).......{
    if(u.matches("ryan") && p.matches("biugos"){
      Intent i = new Intent(getApplicationContext(),mainForm.class);
      startActivity(i);
    }
}

```

Answer: 
That happend because the Image is a Widget and "the real image" (the picture) is a texture of that Widget, and *by default, the image is centered and fits inside the widget bounding box. If you don’t want that, you can set allow\_stretch to True and keep\_ratio to False.* ([docs](https://kivy.org/docs/api-kivy.uix.image.html#alignment))

For understand that you can add a canvas with a rectangle in the Image Widget like this:

```
Image:
        canvas:
            Color:
                rgba: 1, 1, 1, 0.5
            Rectangle:
                pos: self.pos
                size: self.size
        source: 'dog.jpg'
        pos_hint: {'left':1, 'top':1}
        size_hint: None, None
        allow_stretch: True
        keep_ratio: False

```

And then you can see why the image doesn't do what you want

[![enter image description here](https://i.stack.imgur.com/xHXER.png)](https://i.stack.imgur.com/xHXER.png)

another pic (*the image(texture) is centered and fits inside the widget*):

[![enter image description here](https://i.stack.imgur.com/UnoAX.png)](https://i.stack.imgur.com/UnoAX.png)

One thing you can do is set allow\_stretch: True and keep\_ratio: False
This is the result: (set the size with size\_hint)

[![enter image description here](https://i.stack.imgur.com/oBxMw.png)](https://i.stack.imgur.com/oBxMw.png)
Favcau gives one solution above (and thanks), but I have found what I think is more obvious. All it needs is to have the size defined in the kv file.

```
Image:
    id: image2
    source: 'image_400x90.jpg'
    pos_hint: {'left':1, 'top':1}
    size_hint: None, None
    size: 400, 90
    allow_stretch: True
    keep_ratio: False

```