トップページ

「トップページ」の編集履歴(バックアップ)一覧はこちら

トップページ - (2016/02/11 (木) 09:54:01) の1つ前との変更点

追加された行は緑色になります。

削除された行は赤色になります。

<RelativeLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.imagech.ImageSelectedActivity" > <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/selected" /> </RelativeLayout> **@wikiへようこそ -ウィキはみんなで気軽にホームページ編集できるツールです。 -このページは自由に編集することができます。 -メールで送られてきたパスワードを用いてログインすることで、各種変更(サイト名、トップページ、メンバー管理、サイドページ、デザイン、ページ管理、等)することができます **まずはこちらをご覧ください。 -[[@wikiの基本操作>>http://www1.atwiki.jp/guide/pages/11.html]] -[[編集モード・構文一覧表>>http://www1.atwiki.jp/guide/pages/137.html]] -[[@wikiの設定・管理>>http://www1.atwiki.jp/guide/pages/36.html]] **分からないことは? -[[@wiki ご利用ガイド>>http://atwiki.jp/guide/]] -[[よくある質問>>http://www1.atwiki.jp/guide/pages/21.html]] -[[@wiki更新情報>>http://www1.atwiki.jp/guide/pages/143.html]] -[[@wikiへのお問合せフォーム>>http://atwiki.jp/helpdesk]] 等をご活用ください package com.example.imagech; import java.io.FileDescriptor; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; import android.net.Uri; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.util.Log; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity { private static final int RESULT_PICK_IMAGEFILE = 1001; public int imageNum = 0; public static int correctWidth; public static int correctHeight; public void startIntent1(View view){ imageNum = 1; startIntent(view); } public void startIntent2(View view){ imageNum = 2; startIntent(view); } public void startIntent3(View view){ imageNum = 3; startIntent(view); } public void startIntent4(View view){ imageNum = 4; startIntent(view); } public void startIntent(View view){ // Filter to only show results that can be "opened", such as a // file (as opposed to a list of contacts or timezones) intent.addCategory(Intent.CATEGORY_OPENABLE); // Filter to show only images, using the image MIME data type. // it would be "*/*". intent.setType("image/*"); startActivityForResult(intent, RESULT_PICK_IMAGEFILE); } @Override public void onActivityResult(int requestCode, int resultCode, Intent resultData) { // The ACTION_OPEN_DOCUMENT intent was sent with the request code // READ_REQUEST_CODE. If the request code seen here doesn't match, it's the // response to some other intent, and the code below shouldn't run at all. if (requestCode == RESULT_PICK_IMAGEFILE && resultCode == Activity.RESULT_OK) { // The document selected by the user won't be returned in the intent. // Instead, a URI to that document will be contained in the return intent // provided to this method as a parameter. // Pull that URI using resultData.getData(). Uri uri = null; if (resultData != null) { uri = resultData.getData(); Log.i("", "Uri: " + uri.toString()); try { Bitmap bmp = getBitmapFromUri(uri); if(imageNum == 1){ ImageView imageView = (ImageView)findViewById(R.id.imageView1); imageView.setImageBitmap(bmp); }else if(imageNum == 2){ ImageView imageView = (ImageView)findViewById(R.id.imageView2); imageView.setImageBitmap(bmp); }else if(imageNum == 3){ ImageView imageView = (ImageView)findViewById(R.id.imageView3); imageView.setImageBitmap(bmp); }else if(imageNum == 4){ ImageView imageView = (ImageView)findViewById(R.id.imageView4); imageView.setImageBitmap(bmp); } } catch (IOException e) { e.printStackTrace(); } } } } private Bitmap getBitmapFromUri(Uri uri) throws IOException { ParcelFileDescriptor parcelFileDescriptor = getContentResolver().openFileDescriptor(uri, "r"); FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor(); Bitmap image = BitmapFactory.decodeFileDescriptor(fileDescriptor); parcelFileDescriptor.close(); Bitmap resizedImage1Over4; //display width 480 display height 854 resizedImage1Over4 = Bitmap.createScaledBitmap(image, correctWidth -40, correctHeight -130 , false); return resizedImage1Over4; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Display d = getWindowManager().getDefaultDisplay(); Point p1 = new Point(); d.getSize(p1); correctWidth = p1.x / 2; correctHeight = p1.y / 2; Toast.makeText(this, "width = " + correctWidth, Toast.LENGTH_LONG).show(); Toast.makeText(this, "Height = " + correctHeight, Toast.LENGTH_LONG).show();; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void capture(View view){ //remove buttons Button button1 = (Button)findViewById(R.id.startIntent1); Button button2 = (Button)findViewById(R.id.startIntent2); Button button3 = (Button)findViewById(R.id.startIntent3); Button button4 = (Button)findViewById(R.id.startIntent4); Button button5 = (Button)findViewById(R.id.save1); button1.setVisibility(View.INVISIBLE); button2.setVisibility(View.INVISIBLE); button3.setVisibility(View.INVISIBLE); button4.setVisibility(View.INVISIBLE); button5.setVisibility(View.INVISIBLE); View view1 =(View)findViewById(android.R.id.content); view1.setDrawingCacheEnabled(true); Bitmap cache = view1.getDrawingCache(); Bitmap screenShot = Bitmap.createBitmap(cache); view1.setDrawingCacheEnabled(false); Bitmap resizedScreenShot = Bitmap.createScaledBitmap(screenShot, correctWidth, correctHeight , false); Intent intentToImageSelected = new Intent( this, ImageSelectedActivity.class); intentToImageSelected.putExtra("img", resizedScreenShot); startActivity(intentToImageSelected); } } **[[アットウィキモードでの編集方法>>http://www1.atwiki.jp/guide/pages/226.html#id_6861418f]] -[[文字入力>>http://www1.atwiki.jp/guide/pages/228.html]] -[[画像入力>>http://www1.atwiki.jp/guide/pages/230.html]] -[[表組み>>http://www1.atwiki.jp/guide/pages/914.html]] **[[ワープロモードでの編集方法>>http://www1.atwiki.jp/guide/pages/226.html#id_a14c0938]] -[[文字入力>>http://www1.atwiki.jp/guide/pages/2644.html]] -[[画像入力>>http://www1.atwiki.jp/guide/pages/2645.html]] -[[表組み>>http://www1.atwiki.jp/guide/pages/2646.html]] **その他にもいろいろな機能満載!! -[[@wikiプラグイン一覧>>http://www1.atwiki.jp/guide/pages/264.html]] -[[@wikiかんたんプラグイン入力サポート>>http://www1.atwiki.jp/guide/pages/648.html]] **バグ・不具合を見つけたら? 要望がある場合は? お手数ですが、[[お問合せフォーム>>http://atwiki.jp/helpdesk]]からご連絡ください。 <LinearLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context="com.example.imagech.MainActivity" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_email_black_48dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent1" android:text="add" android:onClick="startIntent1" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView2" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent2" android:text="add" android:onClick="startIntent2" /> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView3" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent3" android:text="add" android:onClick="startIntent3" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView4" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent4" android:text="add" android:onClick="startIntent4" /> </RelativeLayout> </LinearLayout> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/save1" android:text="save1" android:onClick="capture" /> </LinearLayout>
<RelativeLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.imagech.ImageSelectedActivity" > <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/selected" /> </RelativeLayout> **@wikiへようこそ -ウィキはみんなで気軽にホームページ編集できるツールです。 -このページは自由に編集することができます。 -メールで送られてきたパスワードを用いてログインすることで、各種変更(サイト名、トップページ、メンバー管理、サイドページ、デザイン、ページ管理、等)することができます **まずはこちらをご覧ください。 -[[@wikiの基本操作>>http://www1.atwiki.jp/guide/pages/11.html]] -[[編集モード・構文一覧表>>http://www1.atwiki.jp/guide/pages/137.html]] -[[@wikiの設定・管理>>http://www1.atwiki.jp/guide/pages/36.html]] **分からないことは? -[[@wiki ご利用ガイド>>http://atwiki.jp/guide/]] -[[よくある質問>>http://www1.atwiki.jp/guide/pages/21.html]] -[[@wiki更新情報>>http://www1.atwiki.jp/guide/pages/143.html]] -[[@wikiへのお問合せフォーム>>http://atwiki.jp/helpdesk]] 等をご活用ください package com.example.imagech; import java.io.FileDescriptor; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Point; import android.net.Uri; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.util.Log; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity { private static final int RESULT_PICK_IMAGEFILE = 1001; public int imageNum = 0; public static int correctWidth; public static int correctHeight; public void startIntent1(View view){ imageNum = 1; startIntent(view); } public void startIntent2(View view){ imageNum = 2; startIntent(view); } public void startIntent3(View view){ imageNum = 3; startIntent(view); } public void startIntent4(View view){ imageNum = 4; startIntent(view); } public void startIntent(View view){ // Filter to only show results that can be "opened", such as a // file (as opposed to a list of contacts or timezones) intent.addCategory(Intent.CATEGORY_OPENABLE); // Filter to show only images, using the image MIME data type. // it would be "*/*". intent.setType("image/*"); startActivityForResult(intent, RESULT_PICK_IMAGEFILE); } @Override public void onActivityResult(int requestCode, int resultCode, Intent resultData) { // The ACTION_OPEN_DOCUMENT intent was sent with the request code // READ_REQUEST_CODE. If the request code seen here doesn't match, it's the // response to some other intent, and the code below shouldn't run at all. if (requestCode == RESULT_PICK_IMAGEFILE && resultCode == Activity.RESULT_OK) { // The document selected by the user won't be returned in the intent. // Instead, a URI to that document will be contained in the return intent // provided to this method as a parameter. // Pull that URI using resultData.getData(). Uri uri = null; if (resultData != null) { uri = resultData.getData(); Log.i("", "Uri: " + uri.toString()); try { Bitmap bmp = getBitmapFromUri(uri); if(imageNum == 1){ ImageView imageView = (ImageView)findViewById(R.id.imageView1); imageView.setImageBitmap(bmp); }else if(imageNum == 2){ ImageView imageView = (ImageView)findViewById(R.id.imageView2); imageView.setImageBitmap(bmp); }else if(imageNum == 3){ ImageView imageView = (ImageView)findViewById(R.id.imageView3); imageView.setImageBitmap(bmp); }else if(imageNum == 4){ ImageView imageView = (ImageView)findViewById(R.id.imageView4); imageView.setImageBitmap(bmp); } } catch (IOException e) { e.printStackTrace(); } } } } private Bitmap getBitmapFromUri(Uri uri) throws IOException { ParcelFileDescriptor parcelFileDescriptor = getContentResolver().openFileDescriptor(uri, "r"); FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor(); Bitmap image = BitmapFactory.decodeFileDescriptor(fileDescriptor); parcelFileDescriptor.close(); Bitmap resizedImage1Over4; //display width 480 display height 854 resizedImage1Over4 = Bitmap.createScaledBitmap(image, correctWidth -40, correctHeight -130 , false); return resizedImage1Over4; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Display d = getWindowManager().getDefaultDisplay(); Point p1 = new Point(); d.getSize(p1); correctWidth = p1.x / 2; correctHeight = p1.y / 2; Toast.makeText(this, "width = " + correctWidth, Toast.LENGTH_LONG).show(); Toast.makeText(this, "Height = " + correctHeight, Toast.LENGTH_LONG).show();; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void capture(View view){ //remove buttons Button button1 = (Button)findViewById(R.id.startIntent1); Button button2 = (Button)findViewById(R.id.startIntent2); Button button3 = (Button)findViewById(R.id.startIntent3); Button button4 = (Button)findViewById(R.id.startIntent4); Button button5 = (Button)findViewById(R.id.save1); button1.setVisibility(View.INVISIBLE); button2.setVisibility(View.INVISIBLE); button3.setVisibility(View.INVISIBLE); button4.setVisibility(View.INVISIBLE); button5.setVisibility(View.INVISIBLE); View view1 =(View)findViewById(android.R.id.content); view1.setDrawingCacheEnabled(true); Bitmap cache = view1.getDrawingCache(); Bitmap screenShot = Bitmap.createBitmap(cache); view1.setDrawingCacheEnabled(false); Bitmap resizedScreenShot = Bitmap.createScaledBitmap(screenShot, correctWidth, correctHeight , false); Intent intentToImageSelected = new Intent( this, ImageSelectedActivity.class); intentToImageSelected.putExtra("img", resizedScreenShot); startActivity(intentToImageSelected); } } **[[アットウィキモードでの編集方法>>http://www1.atwiki.jp/guide/pages/226.html#id_6861418f]] -[[文字入力>>http://www1.atwiki.jp/guide/pages/228.html]] -[[画像入力>>http://www1.atwiki.jp/guide/pages/230.html]] -[[表組み>>http://www1.atwiki.jp/guide/pages/914.html]] **[[ワープロモードでの編集方法>>http://www1.atwiki.jp/guide/pages/226.html#id_a14c0938]] -[[文字入力>>http://www1.atwiki.jp/guide/pages/2644.html]] -[[画像入力>>http://www1.atwiki.jp/guide/pages/2645.html]] -[[表組み>>http://www1.atwiki.jp/guide/pages/2646.html]] **その他にもいろいろな機能満載!! -[[@wikiプラグイン一覧>>http://www1.atwiki.jp/guide/pages/264.html]] -[[@wikiかんたんプラグイン入力サポート>>http://www1.atwiki.jp/guide/pages/648.html]] **バグ・不具合を見つけたら? 要望がある場合は? お手数ですが、[[お問合せフォーム>>http://atwiki.jp/helpdesk]]からご連絡ください。 <LinearLayout 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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context="com.example.imagech.MainActivity" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_email_black_48dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent1" android:text="add" android:onClick="startIntent1" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView2" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent2" android:text="add" android:onClick="startIntent2" /> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView3" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent3" android:text="add" android:onClick="startIntent3" /> </RelativeLayout> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView4" android:src="@drawable/ic_email_black_48dp"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/startIntent4" android:text="add" android:onClick="startIntent4" /> </RelativeLayout> </LinearLayout> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/save1" android:text="save1" android:onClick="capture" /> </LinearLayout> package com.example.imagech; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; public class ImageSelectedActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_selected); Intent i = this.getIntent(); Bitmap bmp = (Bitmap) i.getParcelableExtra("img"); Bitmap resizedImage = Bitmap.createScaledBitmap(bmp, MainActivity.correctWidth *2, MainActivity.correctHeight*2, false); ImageView imgV = (ImageView)findViewById(R.id.selected); imgV.setImageBitmap(resizedImage); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.image_selected, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }

表示オプション

横に並べて表示:
変化行の前後のみ表示: