Android                
            ツール属性
        
        
            
    サーチ…
備考
Androidには、ツールがXMLファイルに情報を記録できるようにする専用のXML名前空間があります。
名前空間URIは次のとおりです。
 http://schemas.android.com/toolsであり、通常は接頭辞tools:接頭辞にバインドされていtools: 。 
デザイン時レイアウト属性
これらの属性は、Android Studioでレイアウトをレンダリングするときに使用されますが、ランタイムには影響しません。
一般に、レイアウトプレビューにはandroid:ネームスペースではなくネームスペースというtools:を使用するだけで、どのAndroidフレームワークアトリビュートも使用できます。実行時に使用されるandroid: namespace属性と、一致するtools:属性(レイアウトプレビューの実行時属性をオーバーライドする)の両方を追加できます。 
「備考」の節で説明されているように、ツールの名前空間を定義するだけです。
たとえば、次のようなtext属性があります。 
<EditText 
      tools:text="My Text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
 または、 visibility属性を使用してプレビュー表示を解除する: 
<LinearLayout
        android:id="@+id/ll1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:visibility="gone" />
 レイアウトをアクティビティやフラグメントに関連付けるcontext属性
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity" >
 または、別のレイアウトでレイアウトプレビューを表示およびshowInするためのshowIn属性
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/text"
    tools:showIn="@layout/activity_main" />
    
    
    
    
    Modified text is an extract of the original Stack Overflow Documentation
        ライセンスを受けた CC BY-SA 3.0
        所属していない Stack Overflow