Merge "docs: Fixed broken image link, and broke long lines in code samples" into lmp-docs
This commit is contained in:
committed by
Android (Google) Code Review
commit
0aef0abf3d
@@ -181,7 +181,7 @@ file.</p>
|
|||||||
<li>Run the application.</li>
|
<li>Run the application.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>You should see the following:</p>
|
<p>You should see the following:</p>
|
||||||
<img src="images/hello-tablelayout.png" width="150px" />
|
<img src="{@docRoot}guide/topics/ui/images/hello-tablelayout.png" width="150px" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,10 @@ public void onCreate(Bundle savedInstanceState) {
|
|||||||
gridview.setAdapter(new ImageAdapter(this));
|
gridview.setAdapter(new ImageAdapter(this));
|
||||||
|
|
||||||
gridview.setOnItemClickListener(new OnItemClickListener() {
|
gridview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View v,
|
||||||
Toast.makeText(HelloGridView.this, "" + position, Toast.LENGTH_SHORT).show();
|
int position, long id) {
|
||||||
|
Toast.makeText(HelloGridView.this, "" + position,
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -118,7 +120,8 @@ public class ImageAdapter extends BaseAdapter {
|
|||||||
// create a new ImageView for each item referenced by the Adapter
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
ImageView imageView;
|
ImageView imageView;
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
if (convertView == null) {
|
||||||
|
// if it's not recycled, initialize some attributes
|
||||||
imageView = new ImageView(mContext);
|
imageView = new ImageView(mContext);
|
||||||
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
|
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
|
||||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
|
|||||||
Reference in New Issue
Block a user