Tuesday, January 31, 2012

gridview take2 issues


@Override
public View getView(int position, View convertView, ViewGroup parent) {
        TextView textView;
        if (convertView == null) {  // if it's not recycled, initialize some attributes
            textView = new TextView(mContext);
//            textView.setLayoutParams(new GridView.LayoutParams(40, 40));
            textView.setPadding(1, 8, 1, 8);
        } else {
            textView = (TextView) convertView;
        }
        textView.setText(mGridViewArrayStrings[position]);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,7.0f);
        //TypedValue.COMPLEX_UNIT_PX : Pixels
        //TypedValue.COMPLEX_UNIT_SP : Scaled Pixels
        //TypedValue.COMPLEX_UNIT_DIP : Device Independent Pixels
        return textView;
}

================

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:numColumns="7"
    android:stretchMode="columnWidth"
    android:gravity="center"
android:soundEffectsEnabled="true"/>

================


GDB with text ui

$ gdb -tui

android how to's

http://omappedia.org/wiki/Android_How-tos

Thursday, January 26, 2012

grid view notes





<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:columnWidth="90dp"
    android:numColumns="6"
    android:verticalSpacing="3dp"
    android:horizontalSpacing="10dp"
    android:stretchMode="columnWidth"
    android:gravity="center"
android:soundEffectsEnabled="true"/>

The example helloGridview has the vertical spacing as 10dp.  Changing to 3 did not have an effect.  I am setting the text size in the baseadapter like so:


       textView.setText(mGearStrings[position]);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,7.0f);