XML : (Java) Scrolling background image that's being repeated from XML

I've been trying to have my background image infinitely scroll vertically on the main activity in my android application. However, while the repeated image coding is working great, I just can't figure out how to get it to scroll because it's an XML and not a typical image.

I'm fairly new at this, but trying my best! Attached is the coding I'm using for the background image and the main menu activity.

Any help on what direction to take from here would be overwhelmingly appreciated. :)

Main Menu Java:

  public class MainMenu extends AppCompatActivity {    @Override  protected void onCreate(Bundle savedInstanceState) {      super.onCreate(savedInstanceState);      setContentView(R.layout.activity_main_menu);      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);      setSupportActionBar(toolbar);        //Button      Button g1SelectButton = (Button) findViewById(R.id.button_gen1);      Button g2SelectButton = (Button) findViewById(R.id.button_gen2);        //On Click Listeners      g1SelectButton.setOnClickListener(new View.OnClickListener() {          public void onClick(View v) {              startActivity(new Intent(MainMenu.this, G1List.class));          }      });        g2SelectButton.setOnClickListener(new View.OnClickListener() {          @Override          public void onClick(View view) {              Snackbar.make(view, "Coming soon!", Snackbar.LENGTH_LONG)                      .setAction("Action", null).show();          }      });  }    }    

Main Menu XML:

  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:tools="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="@drawable/backrepeat"  android:gravity="center_horizontal"  android:paddingBottom="@dimen/activity_vertical_margin"  android:paddingLeft="@dimen/activity_horizontal_margin"  android:paddingRight="@dimen/activity_horizontal_margin"  android:paddingTop="@dimen/activity_vertical_margin"  app:layout_behavior="@string/appbar_scrolling_view_behavior"    .......And it continues as usual from there.    

backrepeat XML:

  <bitmap  xmlns:android="http://schemas.android.com/apk/res/android"  android:src="@drawable/backgroundseg"  android:tileMode="repeat"  android:dither="true" />    

No comments:

Post a Comment