クラス TextView と BaseAdapter を結び付けてパラメータを TextView に渡す方法は?
私の BaseAdapter.class
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder view;
LayoutInflater inflator = activity.getLayoutInflater();
if (convertView == null) {
view = new ViewHolder();
convertView = inflator.inflate(R.layout.item_grid, null);
view.txtViewTitle = (TextView) convertView
.findViewById(R.id.myImageViewText);
convertView.setTag(view);
} else {
view = (ViewHolder) convertView.getTag();
}
view.txtViewTitle.setText(list.get(position));
return convertView;
}
私のxml
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
そしてTextView...
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
int width = getWidth();
canvas.drawText("Some Text", (160 - width) / 2, 20, strokePaint); - **how to transfer parameters here??**
canvas.drawText("Some Text", (160 - width) / 2, 20, textPaint);
}