기본 콘텐츠로 건너뛰기

글

Android, layout background tile

Layout layout = ... Bitmap bmp = BitmapFactory. decodeResource (getResources(), R.drawable. paper0 ); BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(),bmp); bitmapDrawable.setTileModeXY(Shader.TileMode. REPEAT , Shader.TileMode. REPEAT ); layout .setBackgroundDrawable(bitmapDrawable);

Android, simple Fragment sample

* Main ---------------------------------------------------------- ***** xml <? xml version= "1.0" encoding= "utf-8" ?> < LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android :layout_width= "match_parent" android :layout_height= "match_parent" android :orientation= "vertical" xmlns: tools = "http://schemas.android.com/tools" > < LinearLayout android :orientation= "horizontal" android :layout_width= "match_parent" android :layout_height= "wrap_content" > < Button android :layout_width= "wrap_content" android :layout_height= "wrap_content" android :text= "fragment1" android :id= "@+id/button1" android :layout_weight= "1" android :onClick= "selectFrag" /...

Android, access gallery

private static final int REQUEST_PICK_IMAGE = 1 ; protected void ... { ... Intent photoPickerIntent = new Intent(Intent. ACTION_PICK ); photoPickerIntent.setType( "image/*" ); startActivityForResult(photoPickerIntent, REQUEST_PICK_IMAGE ); ... } @Override protected void onActivityResult( final int requestCode, final int resultCode, final Intent data) { switch (requestCode) { case REQUEST_PICK_IMAGE : if (resultCode == RESULT_OK ) { //handle image //data.getData } else { finish(); } break ; default : super .onActivityResult(requestCode, resultCode, data); break ; } }