android.view.View 
リファレンス:http://developer.android.com/reference/android/view/View.html
SUMMARY 
XML属性 | ||
属性 | 対応メソッド | 概要 |
android:background | setBackgroundResource(int) | 背景として利用する描画領域の設定をします。 |
android:clickable | setClickable(boolean) | クリックイベントに反応するか設定をします。 |
android:drawingCacheQuality | setDrawingCacheQuality(int) | 描画時の半透明の質の設定をします。 |
android:fadingEdge | setVerticalFadingEdgeEnabled(boolean) | スクロール時にどの縁が色あせるかを設定します。 |
android:fadingEdgeLength | setVerticalFadingEdgeLength() | 色あせをする縁の長さを設定します。 |
android:fitsSystemWindows | - | レイアウトをシステムウインドウ(例:ステータスバー)を考慮して調整するかの設定をします。 |
android:focusable | setFocusable(boolean) | Viewがフォーカスを取得可能か設定をします。 |
android:focusableInTouchMode | setFocusableInTouchMode(boolean) | Touchモード時にViewがフォーカスを取得可能か設定をします。 |
android:hapticFeedbackEnabled | setHapticFeedbackEnabled(boolean) | 長押しのようなイベント時にViewが「触覚フィードバック」を取得可能か設定をします。 |
android:id | setId(int) | Viewに識別子を設定します。 |
android:keepScreenOn | setKeepScreenOn(boolean) | ViewのWindowがvisibleの間、画面がオンの状態を保つかを設定します。 |
android:longClickable | setLongClickable(boolean) | ロングクリックイベントに反応するか設定をします。 |
android:nextFocusDown | setNextFocusDownId(int) | フォーカスが下方向に遷移した時の遷移先Viewを定義します。 |
android:nextFocusLeft | setNextFocusLeftId(int) | フォーカスが左方向に遷移した時の遷移先Viewを定義します。 |
android:nextFocusRight | setNextFocusRightId(int) | フォーカスが右方向に遷移した時の遷移先Viewを定義します。 |
android:nextFocusUp | setNextFocusnextFocusUpId(int) | フォーカスが上方向に遷移した時の遷移先Viewを定義します。 |
android:padding | setPadding(int,int,int,int) | 上下左右のパディングをピクセル単位で設定します。 |
android:paddingBottom | setPadding(int,int,int,int) | 下方向のパディングをピクセル単位で設定します。 |
android:paddingLeft | setPadding(int,int,int,int) | 左方向のパディングをピクセル単位で設定します。 |
android:paddingRight | setPadding(int,int,int,int) | 右方向のパディングをピクセル単位で設定します。 |
android:paddingTop | setPadding(int,int,int,int) | 上方向のパディングをピクセル単位で設定します。 |
android:saveEnabled | setSaveEnabled(boolean) | フリーズした時にViewの状態を保存するか設定します。 |
android:scrollX | - | 水平方向スクロールオフセットの初期値をピクセル単位で設定します。 |
android:scrollY | - | 垂直方向スクロールオフセットの初期値をピクセル単位で設定します。 |
android:scrollbarAlwaysDrawHorizontalTrack | - | 水平方向スクロールバーを常に表示するかを設定します。 |
android:scrollbarAlwaysDrawVerticalTrack | - | 垂直方向スクロールバーを常に表示するかを設定します。 |
android:scrollbarSize | - | 垂直スクロールバーの幅と水平スクロールバーの高さを設定します。 |
android:scrollbarThumbHorizontal | - | 水平スクロールバーの「つまみ」用描画領域を定義します。 |
android:scrollbarThumbVertical | - | 垂直スクロールバーの「つまみ」用描画領域を定義します。 |
android:scrollbarTrackHorizontal | - | 水平スクロールバー用描画領域を定義します。 |
android:scrollbarTrackVertical | - | 垂直スクロールバー用描画領域を定義します。 |
android:scrollbars | - | 表示するスクロールバーを指定します。 |
android:soundEffectsEnabled | setSoundEffectsEnabled(boolean) | クリックやタッチ時にサウンドエフェクト効果を可能にするかを設定する。 |
android:visibility | setVisibility(int) | 初期状態でViewを表示するかを設定する。 |
XML属性 
- android:background
または、"#rgb"、"#argb"、"#rrggbb"、"#aarrggbb"型で色を指定します。
- android:clickable
指定値 デフォルト 動作 true クリックイベントに反応します。 false クリックイベントに反応しません。
- android:drawingCacheQuality
指定値 デフォルト 動作 auto ○ フレームワークが決定します。 low 色の深みは落ちますが、使用するメモリ容量は少ないです。 high 色の深みは高まりますが、使用するメモリ容量は大きいです。 - サンプルコード
DrawingCacheQualitySample.java
public class DrawingCacheQualitySample extends Activity {
- サンプルコード
@Override public void onCreate( Bundle savedInstanceState) { super.onCreate( savedInstanceState); setContentView( R.layout.sample);
Button drawingCacheQualityAuto = ( Button) findViewById( R.id.drawing_cache_quality_auto); Button drawingCacheQualityHigh = ( Button) findViewById( R.id.drawing_cache_quality_high); Button drawingCacheQualityLow = ( Button) findViewById( R.id.drawing_cache_quality_low);
drawingCacheQualityAuto.setDrawingCacheEnabled( true); drawingCacheQualityHigh.setDrawingCacheEnabled( true); drawingCacheQualityLow.setDrawingCacheEnabled( true); } }
- サンプルコード(レイアウト)
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <Button android:id="@+id/drawing_cache_quality_auto" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/auto" android:drawingCacheQuality="auto" /> <Button android:id="@+id/drawing_cache_quality_high" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/auto" android:drawingCacheQuality="high" /> <Button android:id="@+id/drawing_cache_quality_low" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/low" android:drawingCacheQuality="low" /> </LinearLayout>
- android:fadingEdge
指定値 デフォルト 動作 none どの縁も色あせません。 horizontal 水平方向のみ色あせます。 vertical 垂直方向のみ色あせます。
- android:fadingEdgeLength
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。- サンプルコード
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:fadingEdgeLength="100dip" android:background="#000000"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#FFFFFF"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20dip" android:textColor="#000000" android:text="@string/sample_string" /> </LinearLayout> </ScrollView>
- サンプルコード
- android:fitsSystemWindows
指定値 デフォルト 動作 true レイアウト時にシステムウインドウを考慮します。 false レイアウト時にシステムウインドウを考慮しません。
- android:focusable
指定値 デフォルト 動作 true Viewにフォーカスが移ります。ただし、requestFocus()を呼んでいる処理がある場合は、そちらが優先されます。 false ○ ユーザはフォーカスをViewに移すことはできません。
- android:focusableInTouchMode
指定値 デフォルト 動作 true Viewはフォーカスを取得します。その後、フォーカスを取得可能に設定されていないViewがクリックされてもフォーカスは遷移しません。 false Viewはフォーカスを取得できません。
- android:hapticFeedbackEnabled
指定値 デフォルト 動作 true 「触覚フィードバック」を取得可能です。 false 「触覚フィードバック」を取得できません。
- android:id
@+ syntax を使用して識別子を設定する場合は、リソース参照でなくてはいけません(例:android:id="@+id/my_id" と設定した場合は、findViewById(R.id.my_id). と指定することでViewを取得できます)。
- android:keepScreenOn
指定値 デフォルト 動作 true オンの状態で保ちます。 false オフの状態になります。
- android:longClickable
指定値 デフォルト 動作 true ロングクリックイベントに反応します。 false ロングクリックイベントに反応しません。
- android:nextFocusDown
遷移先のViewが存在しない、または、非表示になっている階層に属している状態で、フォーカスを移そうとした場合は、RuntimeExceptionがスローされます。
- android:nextFocusLeft
遷移先のViewが存在しない、または、非表示になっている階層に属している状態で、フォーカスを移そうとした場合は、RuntimeExceptionがスローされます。
- android:nextFocusRight
遷移先のViewが存在しない、または、非表示になっている階層に属している状態で、フォーカスを移そうとした場合は、RuntimeExceptionがスローされます。
- android:nextFocusUp
遷移先のViewが存在しない、または、非表示になっている階層に属している状態で、フォーカスを移そうとした場合は、RuntimeExceptionがスローされます。
- android:padding
パディングはViewの縁とViewのコンテンツ表示領域との間のスペースです。
明示的に指定したパディングの値はバックグラウンドのパディング値を上書きします。
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。- サンプルコード
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="30dip"> </LinearLayout>
- サンプルコード
- android:paddingBottom
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。- サンプルコード
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="30dip"> </LinearLayout>
- サンプルコード
- android:paddingLeft
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。
- サンプルコード
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="30dip"> </LinearLayout>
- android:paddingRight
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。
- サンプルコード
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingRight="30dip"> </LinearLayout>
- android:paddingTop
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。- サンプルコード
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="30dip"> </LinearLayout>
- サンプルコード
- android:saveEnabled
指定値 デフォルト 動作 true ○ 状態が保存されますが、前提条件としてViewはIDを割り当てられている必要があります。 false Viewの状態は保存されませんが、内部の部品は明示的に指定されていない限り保存されます。
- android:scrollX
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。
- android:scrollY
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。
- android:scrollbarAlwaysDrawHorizontalTrack
指定値 デフォルト 動作 true 常に表示されます。 false 表示されないこともあります。
- android:scrollbarAlwaysDrawVerticalTrack
指定値 デフォルト 動作 true 常に表示されます。 false 表示されないこともあります。
- android:scrollbarSize
dp (密度非依存ピクセル)、sp (倍率非依存ピクセル)、in (インチ)、mm (ミリメータ)です。
または、このタイプの値を含めている他のリソース、テーマ属性の参照を指定します。
- android:scrollbarThumbHorizontal
- サンプルコード(レイアウト)
<ScrollView android:layout_width="wrap_content" android:layout_height="fill_parent" android:scrollbarThumbVertical="@drawable/scrollbar_thumb"> </ScrollView>
- サンプルコード(scrollbar_thumb.xml)
<shape> <gradient android:startColor="#FF0000" android:endColor="#FFFFFF" android:angle="0" /> <corners android:radius="20dp" /> </shape>
- android:scrollbarThumbVertical
- サンプルコード(レイアウト)
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbarThumbVertical="@drawable/scrollbar_thumb"> </ScrollView>
- サンプルコード(scrollbar_thumbl.xml)
<shape> <gradient android:startColor="#FF0000" android:endColor="#FFFFFF" android:angle="0" /> <corners android:radius="20dp" /> </shape>
- サンプルコード(レイアウト)
- android:scrollbarTrackHorizontal
- サンプルコード(レイアウト)
<HorizontalScrollView android:layout_width="wrap_content" android:layout_height="fill_parent" android:scrollbarTrackVertical="@drawable/scrollbar_track"> </HorizontalScrollView>
- サンプルコード(scrollbar_track.xml)
<shape> <gradient android:startColor="#FF0000" android:endColor="#000000" android:angle="0" /> <corners android:radius="30dp" /> </shape>
- android:scrollbarTrackVertical
- サンプルコード(レイアウト)
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbarTrackVertical="@drawable/scrollbar_track"> </ScrollView>
- サンプルコード(scrollbar_track.xml)
<shape> <gradient android:startColor="#FF0000" android:endColor="#000000" android:angle="0" /> <corners android:radius="30dp" /> </shape>
- サンプルコード(レイアウト)
- android:scrollbars
指定値 デフォルト 動作 none スクロールバーを非表示にします。 horizontal 水平スクロールバーのみ表示します。 vertical 垂直スクロールバーのみ表示します。
- サンプルコード
<ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="none" android:background="#000000"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#FFFFFF"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="20dip" android:textColor="#000000" android:text="@string/sample_string" /> </LinearLayout> </ScrollView>
- android:soundEffectsEnabled
指定値 デフォルト 動作 true サウンドエフェクトが有効になります。 false サウンドエフェクトが無効になります。
- android:visibility
指定値 デフォルト 動作 visible ○ 表示 invisible レイアウト上にスペースがある場合は表示される。 gone 完全非表示