Android 扒開美女衣服,android扒開美女

來源:互聯網
上載者:User

Android 扒開美女衣服,android扒開美女

本文主要實現一個小的扒開美女衣服的遊戲項目

效果如下:

項目布局設計:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity" >    <ImageView        android:id="@+id/iv_after"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />    <ImageView        android:id="@+id/iv_pre"        android:layout_width="wrap_content"        android:layout_height="wrap_content" /></FrameLayout>

邏輯部分代碼:

public class MainActivity extends Activity {    private ImageView iv_after;    private ImageView iv_before;    private Bitmap alterBitmap;    private Canvas canvas;    private Paint paint;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        BitmapFactory.Options opts = new Options();        opts.inSampleSize = 2;        iv_after = (ImageView) findViewById(R.id.iv_after);        iv_before = (ImageView) findViewById(R.id.iv_pre);        Bitmap after = BitmapFactory.decodeResource(getResources(),                R.drawable.after19, opts);        Bitmap before = BitmapFactory.decodeResource(getResources(),                R.drawable.pre19, opts);        // 可以修改的空白的bitmap        alterBitmap = Bitmap.createBitmap(before.getWidth(),                before.getHeight(), before.getConfig());        canvas = new Canvas(alterBitmap);        paint = new Paint();        paint.setStrokeWidth(5);        paint.setColor(Color.BLACK);        canvas.drawBitmap(before, new Matrix(), paint);        iv_after.setImageBitmap(after);        iv_before.setImageBitmap(alterBitmap);        iv_before.setOnTouchListener(new OnTouchListener() {            @Override            public boolean onTouch(View v, MotionEvent event) {                switch (event.getAction()) {                case MotionEvent.ACTION_DOWN:                    break;                case MotionEvent.ACTION_MOVE:                    int newX = (int) event.getX();                    int newY = (int) event.getY();                    for (int i = -6; i < 6; i++) {                        for (int j = -6; j < 6; j++) {                            alterBitmap.setPixel(i + newX, j + newY,                                    Color.TRANSPARENT);                        }                    }                    iv_before.setImageBitmap(alterBitmap);                    break;                case MotionEvent.ACTION_UP:                    break;                default:                    break;                }                return true;            }        });    }}

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.