Android Open Source - ArchPad C Bordered Text View






From Project

Back to project page ArchPad.

License

The source code is released under:

GNU General Public License

If you think the Android project ArchPad listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.Andryyo.ArchPad.statistics;
//from   w w w.  j  av a2 s  .  c om
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextView;
import com.Andryyo.ArchPad.R;

/**
* Created with IntelliJ IDEA.
* User: ???????
* Date: 12.05.13
* Time: 12:25
* To change this template use File | Settings | File Templates.
*/
public class CBorderedTextView extends TextView {
        int color;
        int width;
        Paint paint = new Paint();
        Rect rect;

        public CBorderedTextView(Context context)   {
            super(context);
            paint.setColor(Color.RED);
            paint.setStrokeWidth(1);
            paint.setStyle(Paint.Style.STROKE);
        }

        public CBorderedTextView(Context context, AttributeSet attrs) {
            super(context, attrs);
            TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CBorderedTextView,0,0);
            try
            {
                color = a.getColor(R.styleable.CBorderedTextView_borderColor, Color.WHITE);
                width = a.getInt(R.styleable.CBorderedTextView_borderWidth,0);
            }
            finally {
                a.recycle();
            }
            paint.setColor(color);
            paint.setStrokeWidth(width);
            paint.setStyle(Paint.Style.STROKE);
        }

        @Override
        public void onSizeChanged(int w, int h, int oldw, int oldh)
        {
            super.onSizeChanged(w,h,oldw, oldh);
            rect = new Rect(0,0,w-1,h-1);
        }
        @Override
        public void onDraw(Canvas canvas) {
            canvas.drawRect(rect, paint);
            super.onDraw(canvas);
        }
    }




Java Source Code List

com.Andryyo.ArchPad.CArrow.java
com.Andryyo.ArchPad.CShot.java
com.Andryyo.ArchPad.MainActivity.java
com.Andryyo.ArchPad.archeryFragment.CArcheryFragment.java
com.Andryyo.ArchPad.archeryFragment.CCurrentEndView.java
com.Andryyo.ArchPad.archeryFragment.CDistanceTemplate.java
com.Andryyo.ArchPad.archeryFragment.CDistance.java
com.Andryyo.ArchPad.archeryFragment.CRoundTemplate.java
com.Andryyo.ArchPad.archeryFragment.CRound.java
com.Andryyo.ArchPad.archeryFragment.IOnShotAddListener.java
com.Andryyo.ArchPad.archeryFragment.?EndsCounterView.java
com.Andryyo.ArchPad.database.CSQLiteOpenHelper.java
com.Andryyo.ArchPad.note.CNoteCreateActivity.java
com.Andryyo.ArchPad.note.CNotesFragment.java
com.Andryyo.ArchPad.sight.CSightSelectFragment.java
com.Andryyo.ArchPad.sight.?SightPropertiesFragment.java
com.Andryyo.ArchPad.start.CArrowSelectView.java
com.Andryyo.ArchPad.start.CColorSelectView.java
com.Andryyo.ArchPad.start.CRoundSelectView.java
com.Andryyo.ArchPad.start.CStartFragment.java
com.Andryyo.ArchPad.start.CTargetSelectView.java
com.Andryyo.ArchPad.start.IOnFragmentSwapRequiredListener.java
com.Andryyo.ArchPad.statistics.CBorderedTextView.java
com.Andryyo.ArchPad.statistics.CRecordViewFragment.java
com.Andryyo.ArchPad.statistics.CStatisticsFragment.java
com.Andryyo.ArchPad.statistics.IOnUpdateListener.java
com.Andryyo.ArchPad.target.CEditableTargetView.java
com.Andryyo.ArchPad.target.CRing.java
com.Andryyo.ArchPad.target.CTargetView.java
com.Andryyo.ArchPad.target.CTarget.java
com.Andryyo.ArchPad.target.CZoomableTargetView.java