package com.hh.LetterGame;
import android.app.Activity;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;
public class MainActivity extends Activity {
//This is what is first displayed when the person opens the app:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Displays the letters on the board.
GridView gridview = (GridView) findViewById(R.id.letters);
gridview.setAdapter(new letterImageAdapter(this));
//Controls what is displayed when the user clicks on the letter.
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
Toast.makeText(MainActivity.this, "" + position, Toast.LENGTH_SHORT).show();
}
});
//Displays the header, including players and word selected.
//NOT FINISHED: Needs to show player pictures and also the word the player is making.
GridView header = (GridView) findViewById(R.id.header);
}
//Draw lines between the letters.
//Menu options within the app.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
所以这是我的代码到目前为止。为了在单元格上绘制一条线(此时包含图像),我想我知道我需要使用Paint或Path(哪一个?)。在其中,我将声明起点将是什么,然后当用户触摸屏幕的另一部分时,这将是第二点。欢迎任何建议。我真的,真的很新,所以任何帮助都非常感谢。谢谢。