Note that there are some explanatory texts on larger screens.

plurals
  1. POGridView entries are being added from the bottom up
    primarykey
    data
    text
    <p>I want to add entries to my GridView starting at the top, but instead the first entry is registered at the bottom left. I have another piece of code in my project that adds entries to a GridView and the code is identical, and works how I want it to. I'm sure this is a simple fix, but I can't seem to figure out where the problem lies.</p> <p><img src="https://i.stack.imgur.com/sdGei.jpg" alt="ScreenShot"></p> <p>Here is my layout code for the form in the picture</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ll1" android:layout_above="@+id/ll2" &gt; &lt;GridView android:id="@+id/gvObjects" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numColumns="3" android:horizontalSpacing="4dip" android:gravity="center" android:verticalSpacing="4dip" android:padding="4dip" android:stretchMode="columnWidth" &gt; &lt;/GridView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/ll2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignTop="@+id/btnDownloadObjects" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;Button android:id="@+id/btnDownloadObjects" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:text="Download Objects" android:textSize="25sp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The next piece of code is my ImageView that is added within the GridView as an entry</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ImageView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ivObject" android:layout_width="fill_parent" android:layout_height="100dip" android:adjustViewBounds="true" android:contentDescription="@string/descr_image" android:scaleType="centerInside" /&gt; </code></pre> <p>The following method registers the ImageView as an adapter for my GridView</p> <pre><code>private void populateGridView(){ GridView gv = (GridView) findViewById(R.id.gvObjects); gv.setAdapter(new ImageAdapter()); gv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { } }); } </code></pre> <p>Finally, here is my ImageAdapter class</p> <pre><code>public class ImageAdapter extends BaseAdapter{ @Override public View getView(int position, View convertView, ViewGroup parent) { final ImageView imageView; if (convertView == null) { imageView = (ImageView) getLayoutInflater().inflate(R.layout.picture_list_object, parent, false); } else { imageView = (ImageView) convertView; } File picFile = new File(Global.hairFolder.get(position)); Uri picUri = Uri.fromFile(picFile); System.out.println(picUri.toString()); imageLoader.displayImage(picUri.toString(), imageView, options); return imageView; } @Override public int getCount() { // TODO Auto-generated method stub return Global.hairFolder.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload