android - When image moves from left to right and right to left a blank space is seen -


when image moves left right , right left, left white space. want fill layout image animation looks better , no white space see.

enter image description here

this white area covered picture complete background moves.

mainactivity.java

package com.example.abdul.game;  import android.opengl.matrix; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.animation.animation; import android.view.animation.translateanimation; import android.widget.framelayout; import android.widget.imageview; import android.widget.linearlayout;   public class mainactivity extends actionbaractivity {  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     framelayout img_animation = (framelayout) findviewbyid(r.id.img_animation);      translateanimation animation = new translateanimation(0.0f, 400.0f,             0.0f, 0.0f);          //  new translateanimation(xfrom,xto, yfrom,yto)     animation.setduration(7000);  // animation duration     animation.setrepeatcount(animation.infinite);  // animation repeat count     animation.setrepeatmode(2);   // repeat animation (left right, right left ) //      animation.setfillafter(true);      img_animation.startanimation(animation);  // start animation      }  @override public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu_main, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     // handle action bar item clicks here. action bar     // automatically handle clicks on home/up button, long     // specify parent activity in androidmanifest.xml.     int id = item.getitemid();      //noinspection simplifiableifstatement     if (id == r.id.action_settings) {         return true;     }      return super.onoptionsitemselected(item); } } 

activity_main.xml

<framelayout  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent" android:layout_height="match_parent"   android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:id="@+id/img_animation" android:background="@drawable/a" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin"   tools:context=".mainactivity">  <imageview android:layout_width="125dp" android:layout_height="125dp" android:background="#000"/>  </framelayout> 


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -