2014年3月30日日曜日

excelでファイルサイズが異常に大きい場合



データ量に対して明らかにエクセルのファイルサイズが大きい場合

「ホーム」→「編集」→「検索と選択」→「ジャンプ」→「セル選択」→「最後のセル」→「OK」

カーソルが移動した場所から左上に移動させていき、空白の部分に対して削除を行う。

2014年1月6日月曜日

ImageButtonをmargineを使い十字に配置する例

ImageButtonを指定した位置にプロットして配置する方法。
ImageButtonをmargineを使い十字に配置する例。

・上から、中心、左、右、上、下のボタン
・FrameLayoutやImageButtonのgravityは設定しない。デフォルトのままにする。
・それぞれのImageButtonにlayout_margineLeft, layout_Topで位置を付ける。
・layout_margineRight, layout_Buttomは使えない。正しくレイアウトされない。
・よって中心をlayout_marginLeft="50dp"、layout_marginTop="50dp"としてプロットする。
・中心を0,0でやろうとするとlayout_marginRight, layout_marginButtom方向が正しくプロットされない。

    <FrameLayout
        android:id="@+id/canvasFrameLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="50dp"
            android:src="@drawable/ic_point" />

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginTop="50dp"
            android:layout_marginLeft="0dp"
            android:src="@drawable/ic_point" />

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginTop="50dp"
            android:layout_marginLeft="100dp"
            android:src="@drawable/ic_point" />

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginTop="0dp"
            android:layout_marginLeft="50dp"
            android:src="@drawable/ic_point" />
       
        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginTop="100dp"
            android:layout_marginLeft="50dp"
            android:src="@drawable/ic_point" />
       
        </FrameLayout>

・未確認だがButtonも一緒だと思う。
・何故layout_margineRight, layout_Buttomで正しくプロットできないのか不明。Imageでは使えるようだが。疑問todo。

2014年1月5日日曜日

ImageButtonをソースコードで配置する例

ImageButtonをソースコードで配置する例です。

FrameLayout canvas = (FrameLayout)this.findViewById(R.id.canvasFrameLayout);
ImageButton imageButton = new ImageButton(this);
imageButton.setImageResource(R.drawable.ic_point);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( 50, 50); //ボタンの大きさ
layoutParams.setMargins(100, 100, 0, 0); //ボタンの表示場所: left,top,right,bottom : 使うのはleft,topのみ
imageButton.setLayoutParams(layoutParams);
canvas.addView(imageButton);

ボタンの大きさは、FrameLayoutのLayoutParamsオブジェクトのLayoutParamsメソッドで指定する。
ボタンの場所は、同様に、FrameLayoutのLayoutParamsオブジェクトのsetMarginsメソッドで指定する。

LayoutParamsオブジェクトをsetLayoutParamsメソッドでImageButtonに反映する。