内容へ移動
猫型iPS細胞研究所
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
INDEX
»
android
»
Shape
トレース:
android:shape
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Shape ====== [[https://developer.android.com/guide/topics/resources/drawable-resource?hl=ja|ドローアブル リソース]] ===== ring ===== ==== 基本 ==== 最低限の実装。キャンバスにサイズにある程度あった円ができる。 円の太さや、キャンバスからの位置を変更しようと思うと、thickness、thicknessRatio、innerRadius、innerRadiusRatioを調整する必要がある。 <code xml> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:useLevel="false" > <size android:width="300dp" android:height="300dp" /> ←キャンバスのサイズになる <stroke android:width="5dp" android:color="#2196F3" /> ←線の太さと色 <solid android:color="@color/colorAccent"/> ←塗りつぶしの色 </shape> </code> {{:android:pasted:20191123-132245.png}} ==== android:thicknessRatio ==== <code xml> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:useLevel="false" android:thicknessRatio="6" ←ここを変えてみる > <size android:width="300dp" android:height="300dp" /> <stroke android:width="5dp" android:color="#2196F3" /> <solid android:color="@color/colorAccent"/> </shape> </code> {{:android:pasted:20191123-132937.png}} ==== android:innerRadiusRatio ==== <code xml> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:useLevel="false" android:innerRadiusRatio="15" ←ここを変える > <size android:width="300dp" android:height="300dp" /> <stroke android:width="5dp" android:color="#2196F3" /> <solid android:color="@color/colorAccent"/> </shape> </code> {{:android:pasted:20191123-133515.png}} ===== line ===== 角度をつけたlineを重ねることでバツが作れる。 角度をつけるには<html>android:fromDegrees</html>、重ねるには<html>layer-list</html>を使用する。 <code xml> <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:fromDegrees="45" > <shape android:shape="line" android:useLevel="false" android:thicknessRatio="15" > <size android:width="150dp" android:height="150dp" /> <stroke android:color="@color/colorAccent" android:width="10dp"/> </shape> </rotate> </item> <item> <rotate android:fromDegrees="135" > <shape android:shape="line" android:useLevel="false" android:thicknessRatio="15" > <size android:width="150dp" android:height="150dp" /> <stroke android:color="@color/colorAccent" android:width="10dp"/> </shape> </rotate> </item> </layer-list> </code> {{:android:pasted:20191123-141944.png}}
android/shape.txt
· 最終更新: 2019/11/23 14:20 by
ips
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ