今年も残すところ、あと6時間程度となりました(´ェ`)ン-・・
ということで、今年最後のブログでは、TextViewにスクロールを付ける方法を書きます。
できあがる画面としては、

こんな感じになります。
1.TextViewタグをScrollViewタグで囲う
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="41dp"
android:layout_marginBottom="50dp"
android:fastScrollEnabled="true" >
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@color/clear_black"
android:text="
いろは歌とは、\n
・・・
説明文
・・・
android:textColor="@color/white"
android:textSize="14dp"
tools:context=".IrohaniNumber" />
</ScrollView>
上記のようにTextViewをScrollViewで囲むとスクロールがつきます。
また、color.xmlファイルには
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="clear_black">#77000000</color>
</resources>
色設定を#AARRGGBBの形式で設定することにより、半透明にできます。
ということで、今年最後のブログでは、TextViewにスクロールを付ける方法を書きます。
できあがる画面としては、

こんな感じになります。
1.TextViewタグをScrollViewタグで囲う
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="41dp"
android:layout_marginBottom="50dp"
android:fastScrollEnabled="true" >
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@color/clear_black"
android:text="
いろは歌とは、\n
・・・
説明文
・・・
android:textColor="@color/white"
android:textSize="14dp"
tools:context=".IrohaniNumber" />
</ScrollView>
上記のようにTextViewをScrollViewで囲むとスクロールがつきます。
また、color.xmlファイルには
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="clear_black">#77000000</color>
</resources>
色設定を#AARRGGBBの形式で設定することにより、半透明にできます。