{"id":49,"date":"2016-01-30T17:16:16","date_gmt":"2016-01-30T08:16:16","guid":{"rendered":"http:\/\/www.hundredapps.net\/?p=49"},"modified":"2017-11-10T09:52:09","modified_gmt":"2017-11-10T00:52:09","slug":"android%e3%81%ae%e7%94%bb%e9%9d%a2user-interface%e3%81%ae%e4%bd%9c%e3%82%8a%e6%96%b9","status":"publish","type":"post","link":"https:\/\/www.hundredapps.net\/?p=49","title":{"rendered":"Android\u306e\u753b\u9762(User Interface)\u306e\u4f5c\u308a\u65b9"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>Android\u3067\u306f\u3001Button(\u30dc\u30bf\u30f3)\u3001RadioButton(\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3)\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9(CheckButton)\u306a\u3069\u306e\u90e8\u54c1\u3092\u3001View(\u30d3\u30e5\u30fc)\u3084Widget(\u30a6\u30a3\u30b8\u30a7\u30c3\u30c8)\u3068\u547c\u3073\u307e\u3059\u3002<br \/> \u203b\u3053\u3053\u304b\u3089\u306f\u3001\u3053\u308c\u3089\u306e\u90e8\u54c1\u3092\u82f1\u8a9e\u8868\u8a18\u3067\u3001View\u3068\u8a18\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306eView\u3092\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u308bViewGroup\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br \/> android\u3067\u306f\u3001ViewGroup\u306e\u4e2d\u306b\u3001View\u3092\u914d\u7f6e\u3057\u3066\u3044\u304f\u5f62\u3092\u3068\u308a\u307e\u3059\u3002<\/p>\n<h2>\u4ee3\u8868\u7684\u306aViewGroup<\/h2>\n<table style=\"height: 185px;\" width=\"746\">\n<tbody>\n<tr>\n<td>Layout\u540d<\/td>\n<td>\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>LinearLayout<\/td>\n<td>\u8981\u7d20\u3092\u7e26\u307e\u305f\u306f\u6a2a\u306e\u4e00\u5217\u306b\u4e26\u3079\u308b\u30ec\u30a4\u30a2\u30a6\u30c8<\/td>\n<\/tr>\n<tr>\n<td>RelativeLayout<\/td>\n<td>\u76f8\u5bfe\u7684\u306a\u4f4d\u7f6e\u3092\u6307\u5b9a\u3057\u3066\u90e8\u54c1\u3092\u914d\u7f6e\u3059\u308b\u30ec\u30a4\u30a2\u30a6\u30c8<\/td>\n<\/tr>\n<tr>\n<td>TableLayout\/TableRow<\/td>\n<td><span style=\"color: #222222;\">TableLayout:\u683c\u5b50\u4e0a\u306b\u914d\u7f6e\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u3059\u3002<\/span>HTML\u306eTable\u30bf\u30b0\u306e\u69cb\u6210\u3068\u4f3c\u3066\u3044\u307e\u3059\u3002TableRow:\u30c6\u30fc\u30d6\u30eb\u306e\u884c HTML\u306etr\u30bf\u30b0\u3068\u4f3c\u3066\u3044\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr>\n<td>FrameLayout<\/td>\n<td>\uff11\u3064\u306eView\u3092\u914d\u7f6e\u3059\u308b\u3060\u3051\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u3059\u304c\u3001<span class=\"st\">\u8907\u6570\u306eView\u3092\u91cd\u306d\u5408\u308f\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/span><\/td>\n<\/tr>\n<tr>\n<td>AbsoluteLayout<\/td>\n<td>\u8868\u793a\u4f4d\u7f6e\u3092\u7d76\u5bfe\u5ea7\u6a19\u3067\u6307\u5b9a\u3059\u308b\u30ec\u30a4\u30a2\u30a6\u30c8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2>\u4ee3\u8868\u7684\u306aView<\/h2>\n<table style=\"height: 437px;\" width=\"809\">\n<tbody>\n<tr>\n<td>View\u540d<\/td>\n<td>\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>TextView<\/td>\n<td>\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b<\/td>\n<\/tr>\n<tr>\n<td>EditView<\/td>\n<td><span style=\"color: #545454;\">\u5165\u529b\u30a8\u30ea\u30a2\u3092\u8868\u793a\u3059\u308b<\/span><br \/> <span style=\"color: #545454;\">HTML\u306e\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9(input type=&#8221;text&#8221;)\u306b\u76f8\u5f53<\/span><\/td>\n<\/tr>\n<tr>\n<td>Button<\/td>\n<td>\u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>Checkbox<\/td>\n<td>\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9<\/td>\n<\/tr>\n<tr>\n<td>ImageView<\/td>\n<td>\u753b\u50cf\u3092\u914d\u7f6e\u3059\u308b<\/td>\n<\/tr>\n<tr>\n<td>ImageButton<\/td>\n<td>\u753b\u50cf\u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>RadioButton<\/td>\n<td>\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>GridView<\/td>\n<td>\u30c7\u30fc\u30bf\u3092\u683c\u5b50\u72b6(\u53c8\u306f\u65b9\u773c)\u3067\u8868\u793a\u3059\u308b(\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u51fa\u6765\u308b)<\/td>\n<\/tr>\n<tr>\n<td>ListView<\/td>\n<td>\u30c7\u30fc\u30bf\u3092\u30ea\u30b9\u30c8\u3067\u8868\u793a\u3059\u308b(\u30b9\u30af\u30ed\u30fc\u30eb\u304c\u51fa\u6765\u308b)<\/td>\n<\/tr>\n<tr>\n<td>ProgressBar<\/td>\n<td>\u30d7\u30ed\u30b0\u30ec\u30b9\u30d0\u30fc<\/td>\n<\/tr>\n<tr>\n<td>AnalogClock \/\u00a0DigitalClock<\/td>\n<td>\u00a0\u30a2\u30ca\u30ed\u30b0\u6642\u8a08 \/ \u30c7\u30b8\u30bf\u30eb\u6642\u8a08<\/td>\n<\/tr>\n<tr>\n<td>ZoomSlider<\/td>\n<td>\u00a0\u30ba\u30fc\u30e0\u30b9\u30e9\u30a4\u30c0\u30fc<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u5358\u4f4d<\/h2>\n<table>\n<tbody>\n<tr>\n<td>Android\u306b\u306f\u69d8\u3005\u306a\u753b\u9762\u30b5\u30a4\u30ba\u3001\u753b\u9762\u5bc6\u5ea6\uff08\u89e3\u50cf\u5ea6\uff09\u306e\u7aef\u672b\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u70ba\u3001<br \/> \u8907\u6570\u89e3\u50cf\u5ea6\u306e\u7aef\u672b\u306b\u5bfe\u5fdc\u3059\u308bdp(dip)\u3068\u3044\u3046\u6700\u9069\u306a\u5358\u4f4d\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002dp(dip) = density-independent pixels\u306e\u7565\u3067\u3059\u3002<br \/> (\u5bc6\u5ea6\u975e\u4f9d\u5b58\u306e\u30d4\u30af\u30bb\u30eb)<\/p>\n<p>dp\u306f160dpi(dots per inch) \u306e\u753b\u9762\u3092\u57fa\u6e96\u3068\u3055\u308c\u3066\u3044\u307e\u3059\u3002160dpi\u306e\u753b\u9762\u3067\u30011dip\u306f\u30011\u30d4\u30af\u30bb\u30eb\u3068\u540c\u3058\u306b\u306a\u308a\u307e\u3059\u3002<br \/> \u89e3\u50cf\u5ea6\u306b\u5bfe\u3059\u308b1dip\u304c\u4f55px\u306b\u306a\u308b\u306e\u304b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u65b9\u6cd5\u3067\u8a08\u7b97\u3067\u304d\u307e\u3059\u3002<br \/>\npx = dp * (dpi \/ 160)<br \/>\n320dpi\u306e\u753b\u9762\u306e\u5834\u5408\u3060\u30681dip\u306f2px\u3067\u8a08\u7b97\u3055\u308c\u3001\u753b\u9762\u4e0a\u306b\u53cd\u6620\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<br \/> \u3088\u3063\u3066\u3001dp\u3067\u8a18\u8f09\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u89e3\u50cf\u5ea6\u304c\u9055\u3046\u7aef\u672b\u306b\u3082\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002<br \/>\nsp = scale-independent pixels<br \/> (\u30b9\u30b1\u30fc\u30eb\u975e\u4f9d\u5b58\u306e\u30d4\u30af\u30bb\u30eb)<br \/>\n\u753b\u9762\u5bc6\u5ea6\u3068\u30e6\u30fc\u30b6\u30fc\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u8a2d\u5b9a\u306e\u4e21\u65b9\u3092\u52a0\u5473\u3059\u308b\u70ba\u3001\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u306e\u6307\u5b9a\u3067\u63a8\u5968\u3055\u308c\u3066\u3044\u308b\u3002\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u753b\u9762\u4f5c\u6210<\/h2>\n<p>\u305d\u308c\u3067\u306f\u3001\u983b\u7e41\u306b\u4f7f\u7528\u3055\u308c\u308b\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\uff11\u3064\u3067\u3042\u308b\u3001LinearLayout(\u30ea\u30cb\u30a2\u30ec\u30a4\u30a2\u30a6\u30c8)\u3092\u4f7f\u7528\u3057\u8aac\u660e\u3057\u3066\u884c\u304d\u307e\u3059\u3002<br \/> LinearLayout\u306f\u3001View\u3092\u7e26\u53c8\u306f\u6a2a\u306b\u914d\u7f6e\u3057\u3066\u3044\u304f\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u3059\u3002<br \/> View\u306f\u9806\u756a\u306b\u4e0a\u3082\u3057\u304f\u306f\u3001\u5de6\u304b\u3089\u9806\u306b\u4e26\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<a href=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/android-layout-linearLayout-011.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/android-layout-linearLayout-011-155x300.png\" alt=\"android-layout-linearLayout-011\" width=\"155\" height=\"300\" class=\"alignnone size-medium wp-image-13\" srcset=\"https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/android-layout-linearLayout-011-155x300.png 155w, https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/android-layout-linearLayout-011.png 278w\" sizes=\"auto, (max-width: 155px) 100vw, 155px\" \/><\/a>\n<p><\/p>\n<p>LinearLayoutActivity.java<\/p>\n<pre>\npublic class LinearLayoutActivity extends Activity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_linearlayout);\n    }\n\n\u301c\u301c\u4ee5\u4e0b\u4e00\u90e8\u7701\u7565\u301c\u301c\n\n}\n<\/pre>\n<p>\u4e0a\u8a18\u306eactivity\u306e\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u30bb\u30c3\u30c8\u3059\u308bsetContentView\u306e\u307f\u3067\u3059\u3002<\/p>\n<p>activity_linearlayout.xml<\/p>\n<pre>\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    >\n\n    <LinearLayout\n        android:orientation=\"vertical\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:layout_weight=\"5\"\n        >\n\n    <LinearLayout\n        android:orientation=\"vertical\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_weight=\"1\"\n        >\n        <TextView\n            android:text=\"green\"\n            android:textSize=\"20sp\"\n            android:background=\"#ff0baa14\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"left|center_vertical\"\n            android:paddingLeft=\"5dp\"\n            android:layout_weight=\"1\"\n            \/>\n\n        <TextView\n            android:text=\"red\"\n            android:textSize=\"20sp\"\n            android:background=\"#ffaa040f\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"center\"\n            android:layout_weight=\"1\"\n            \/>\n        <TextView\n            android:text=\"white\"\n            android:textSize=\"20sp\"\n            android:gravity=\"right|center_vertical\"\n            android:background=\"#ffffff\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            android:paddingRight=\"5dp\"\n            android:layout_weight=\"1\"\n            \/>\n\n    <\/LinearLayout>\n\n    <LinearLayout\n        android:orientation=\"horizontal\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:gravity=\"center\"\n        android:layout_weight=\"1\"\n        >\n        <TextView\n            android:text=\"blue\"\n            android:textSize=\"20sp\"\n            android:background=\"#ff1a1faa\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"left|center_vertical\"\n            android:paddingLeft=\"5dp\"\n            android:layout_weight=\"1\"\n            \/>\n        <TextView\n            android:text=\"yellow\"\n            android:textSize=\"20sp\"\n            android:background=\"#fffffd4b\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"center\"\n            android:layout_weight=\"1\"\n            \/>\n        <TextView\n            android:text=\"pink\"\n            android:textSize=\"20sp\"\n            android:background=\"#ffff0ea1\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"right|center_vertical\"\n            android:paddingRight=\"5dp\"\n            android:layout_weight=\"1\"\n            \/>\n    <\/LinearLayout>\n    <\/LinearLayout>\n\n    <LinearLayout\n        android:orientation=\"horizontal\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        android:gravity=\"center\"\n        android:layout_weight=\"1\"\n        >\n        <Button\n            android:text=\"Button1\"\n            android:textSize=\"17sp\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"left|center_vertical\"\n            android:layout_weight=\"1\"\n            \/>\n        <Button\n            android:text=\"Button2\"\n            android:textSize=\"17sp\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:layout_gravity=\"center\"\n            android:layout_weight=\"1\"\n            \/>\n        <Button\n            android:text=\"Button3\"\n            android:textSize=\"17sp\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"match_parent\"\n            android:gravity=\"right|center_vertical\"\n            android:layout_weight=\"1\"\n            \/>\n    <\/LinearLayout>\n\n<\/LinearLayout>\n\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u5c5e\u6027\u306b\u3064\u3044\u3066\u3001\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<table style=\"height: 226px;\" width=\"504\">\n<tbody>\n<tr>\n<td>\u5c5e\u6027<\/td>\n<td>\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>orientation<\/td>\n<td>\u7e26\u6a2a\u306b\u914d\u7f6e\u3059\u308b<br \/> vertical:\u7e26\u306b\u4e26\u3079\u308b \/ horizontal:\u6a2a\u306b\u4e26\u3079\u308b<\/td>\n<\/tr>\n<tr>\n<td>layout_width<\/td>\n<td>\u6a2a\u5e45<\/td>\n<\/tr>\n<tr>\n<td>layout_height<\/td>\n<td>\u7e26\u5e45<\/td>\n<\/tr>\n<tr>\n<td>layout_weight<\/td>\n<td>\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u6bd4\u91cd<\/td>\n<\/tr>\n<tr>\n<td>layout_gravity<\/td>\n<td>\u30ec\u30a4\u30a2\u30a6\u30c8\u81ea\u4f53\u306e\u914d\u7f6e\u5834\u6240<\/td>\n<\/tr>\n<tr>\n<td>gravity<\/td>\n<td>\u30ec\u30a4\u30a2\u30a6\u30c8\u5185\u306eView\u306e\u914d\u7f6e\u5834\u6240\u3082\u3057\u304f\u306f\u3001View\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u306a\u3069\u306e\u914d\u7f6e\u5834\u6240<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3053\u306e\u4f8b\u306f\u3001\u307e\u305a\u3001\u753b\u9762\u306e\u5927\u67a0\u3067\u3042\u308bLinearLayout\u306b<br \/> android:orientation=&#8221;vertical&#8221;<br \/> android:layout_width=&#8221;match_parent&#8221;<br \/> android:layout_height=&#8221;match_parent&#8221;<br \/> \u3092\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u306f\u3001\u7e26\u306b\u4e26\u3079\u3066\u3001width\u3068height\u306f\u3001<br \/> \u753b\u9762\u4e00\u676f\u306bView\u3092\u914d\u7f6e\u3059\u308b\u3088\u3046\u306b\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u305d\u306e\u4e2d\u306b\u3001\u5165\u308c\u5b50\u3067\u3001LinearLayout\u304c\uff12\u3064\u914d\u7f6e\u3055\u308c\u3066\u304a\u308a\u3001<br \/> \u305d\u308c\u305e\u308c\u3001\u6a2a\u3068\u7e26\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u304c\u3001\u57fa\u672c\u7684\u306aLinearLayout\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3064\u3065\u3044\u3066\u3001ListView\u306e\u8aac\u660e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30ea\u30b9\u30c8\u5f62\u5f0f\u306e\u753b\u9762\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u30ea\u30b9\u30c8\u5f62\u5f0f\u306e\u753b\u9762\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001ListView\u3068\u3044\u3046View\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<a href=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/listview_01.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/listview_01-199x300.png\" alt=\"listview_01\" width=\"199\" height=\"300\" class=\"alignnone size-medium wp-image-21\" srcset=\"https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/listview_01-199x300.png 199w, https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/listview_01.png 483w\" sizes=\"auto, (max-width: 199px) 100vw, 199px\" \/><\/a><br \/>\n<p>\u4f5c\u6210\u65b9\u6cd5\u306f\u3001\u4ee5\u4e0b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">\npublic class SampleListViewActivity extends Activity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_sample_list_view);\n\n        String[] memoLists = new String[] {\n                \"memo1\", \"memo2\", \"memo3\", \"memo4\"\n                ,\"memo5\", \"memo5\", \"memo6\", \"memo7\"\n        };\n\n        ArrayAdapter adapter = new ArrayAdapter(this,\n                android.R.layout.simple_list_item_1, memoLists);\n\n\n        ListView listView = (ListView)findViewById(R.id.ListView01);\n        listView.setAdapter(adapter);\n\n    }<\/pre>\n<p>\u4e0a\u8a18\u306b\u306f\u3001\uff12\u70b9\u306e\u30dd\u30a4\u30f3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">        ArrayAdapter adapter = new ArrayAdapter(this,\n                android.R.layout.simple_list_item_1, memoLists);\n\n<\/pre>\n<p>\u307e\u305a\u3001Adapter\u3092\u300candroid.R.layout.simple_list_item_1\u300d\u3068\u3072\u3082\u4ed8\u3051\u307e\u3059\u3002<br \/> \u300candroid.R.layout.simple_list_item_1\u300d\u306f\u3001Android\u306b\u306f\u3058\u3081\u304b\u3089\u5165\u3063\u3066\u3044\u308b<br \/> \u30ec\u30a4\u30a2\u30a6\u30c8(TextView)\u3067\u3059\u3002<\/p>\n<p>\u203bAdapter\u306f\u3001View\u3068\u30c7\u30fc\u30bf\u306e\u6a4b\u6e21\u3057\u306e\u5f79\u5272\u3092\u62c5\u3063\u3066\u3044\u307e\u3059\u3002<br \/> \u203bArrayAdapter\u306f\u3001\u300c\u914d\u5217\u300d\u3082\u3057\u304f\u306f\u300c\u30ea\u30b9\u30c8\u300d\u306e\u30c7\u30fc\u30bf\u3092TextView\u306b\u30bb\u30c3\u30c8\u3059\u308b\u5f79\u5272\u3092\u62c5\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">        ListView listView = (ListView)findViewById(R.id.ListView01);\n        listView.setAdapter(adapter);\n<\/pre>\n<p>ListView\u306b\u3001\u4e0a\u8a18\u3067\u4f5c\u6210\u3057\u305fadapter\u3092\u30bb\u30c3\u30c8\u3057\u3001\u8868\u793a\u3055\u305b\u308b\u3068\u3044\u3046\u6d41\u308c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3064\u3065\u3044\u3066\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001ListView\u306eView\u3092\u5b9a\u7fa9\u3059\u308b\u306e\u307f\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">\n\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:orientation=\"horizontal\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@color\/lemonchiffon\">\n    <ListView\n        android:id=\"@+id\/ListView01\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"wrap_content\"\n        android:layout_weight=\"1\"\n        \/>\n<\/LinearLayout>\n\n<\/pre>\n<p>\u3064\u3065\u3044\u3066\u3001ListView\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u3064\u3044\u3066\u3001\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u72ec\u81ea\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u4f5c\u308a\u65b9 ListView\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/h2>\n<a href=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/Screen-Shot-2014-08-29-at-1.29.13.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/Screen-Shot-2014-08-29-at-1.29.13-199x300.png\" alt=\"Screen-Shot-2014-08-29-at-1.29.13\" width=\"199\" height=\"300\" class=\"alignnone size-medium wp-image-24\" srcset=\"https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/Screen-Shot-2014-08-29-at-1.29.13-199x300.png 199w, https:\/\/www.hundredapps.net\/wp-content\/uploads\/2016\/01\/Screen-Shot-2014-08-29-at-1.29.13.png 485w\" sizes=\"auto, (max-width: 199px) 100vw, 199px\" \/><\/a>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001\u72ec\u81ea\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u8868\u793a\u3055\u305b\u308b\u306b\u306f\u3001ListView\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class SimpleAdapterActivity extends Activity {\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_simple_adapter);\n\n\n        SimpleAdapter sa = new SimpleAdapter(this,\n                getListData(),\n                R.layout.activity_simple_adapter_row,\n                new String[]{\"content\", \"created\"},\n                new int[]{R.id.content, R.id.created});\n\n        ListView listView = (ListView)findViewById(R.id.ListView01);\n        listView.setAdapter(sa);\n\n    }\n\n\n    @Override\n    public boolean onCreateOptionsMenu(Menu menu) {\n\n        getMenuInflater().inflate(R.menu.simple_adapter, menu);\n        return true;\n    }\n\n    @Override\n    public boolean onOptionsItemSelected(MenuItem item) {\n\n        int id = item.getItemId();\n        if (id == R.id.action_settings) {\n            return true;\n        }\n        return super.onOptionsItemSelected(item);\n    }\n\n    private List<Map<String, String>> getListData() {\n        List<Map<String, String>> listData = new ArrayList<Map<String, String>>();\n\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e201\" }, { \"created\", \"2014-09-13\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e202\" }, { \"created\", \"2014-09-14\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e203\" }, { \"created\", \"2014-09-15\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e204\" }, { \"created\", \"2014-09-16\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e205\" }, { \"created\", \"2014-09-17\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e206\" }, { \"created\", \"2014-09-18\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e207\" }, { \"created\", \"2014-09-19\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e208\" }, { \"created\", \"2014-09-20\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e209\" }, { \"created\", \"2014-09-21\" } }));\n        listData.add(getMapData(new String[][] { { \"content\", \"\u3053\u308c\u306f\u30e1\u30e210\" }, { \"created\", \"2014-09-22\" } }));\n\n        return listData;\n    }\n\n    private Map<String, String> getMapData(String[][] values) {\n\n        Map<String, String> map = new HashMap<String, String>();\n        for (int i = 0; i < values.length; i++) {\n            map.put(values[i][0], values[i][1]);\n        }\n\n        return map;\n    }\n\n}\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u30dd\u30a4\u30f3\u30c8\u3068\u3057\u3066\u3001SimpleAdapter\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3057\u3066\u307e\u3059\u3002<br \/> \u3053\u306e\u30af\u30e9\u30b9\u306f\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u5185\u306b\u3042\u308b\u8907\u6570\u306eView\u306b\u30bb\u30c3\u30c8\u3067\u304d\u308bAdapter\u3067\u3059\u3002<\/p>\n<pre>SimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to)\n<\/pre>\n<table style=\"height: 226px;\" width=\"504\">\n<tbody>\n<tr>\n<td>\u5f15\u6570<\/td>\n<td>\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\uff11\u5f15\u6570<\/td>\n<td>Context<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\uff12\u5f15\u6570<\/td>\n<td>\u30ad\u30fc\u3092String\u578b\u306b\u3057\u305fMap\u306eList<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\uff13\u5f15\u6570<\/td>\n<td>\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u30ea\u30bd\u30fc\u30b9ID<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\uff14\u5f15\u6570<\/td>\n<td>\u7b2c2\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305fMap\u306e\u30ad\u30fc\u3092String\u578b\u306e\u914d\u5217\u3067\u6307\u5b9a\u3059\u308b<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\uff15\u5f15\u6570<\/td>\n<td>\u7b2c\uff13\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30ec\u30a4\u30a2\u30a6\u30c8\u5185\u306b\u3042\u308bView\u306eID\u3092int\u578b\u306e\u914d\u5217\u3067\u6307\u5b9a\u3059\u308b(\u4e26\u3073\u306f\u3001\u7b2c4\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30ad\u30fc\u3068\u5408\u308f\u305b\u308b)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0b\u306f\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u30e1\u30a4\u30f3\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:orientation=\"horizontal\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:background=\"@color\/lemonchiffon\">\n    <ListView\n        android:id=\"@+id\/ListView01\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"wrap_content\"\n        android:layout_weight=\"1\"\n        \/>\n<\/LinearLayout>\n<\/pre>\n<p>\u3064\u3065\u3044\u3066\u3001\u4e0a\u8a18\u306eListView\u306e\u4e2d\u306b\u914d\u7f6e\u3059\u308bView\u304c\u5b9a\u7fa9\u3055\u308c\u305f\u30ec\u30a4\u30a2\u30a6\u30c8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:orientation=\"horizontal\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    >\n\n    <TextView\n        android:id=\"@+id\/id\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:textSize=\"0sp\"\n        android:textColor=\"@android:color\/black\"\n        \/>\n\n    <TextView\n        android:id=\"@+id\/content\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"wrap_content\"\n        android:textSize=\"20sp\"\n        android:textColor=\"@android:color\/black\"\n        android:layout_weight=\"2\"\n        android:layout_marginLeft=\"7dp\"\n        android:maxLines=\"1\"\n        android:scrollHorizontally=\"true\"\n        android:ellipsize=\"end\"\n        \/>\n\n    <TextView\n        android:id=\"@+id\/created\"\n        android:layout_width=\"0dp\"\n        android:layout_height=\"wrap_content\"\n        android:textSize=\"15sp\"\n        android:textColor=\"@android:color\/black\"\n        android:layout_weight=\"1\"\n        android:gravity=\"right\"\n        android:layout_marginRight=\"5dp\"\n        \/>\n\n<\/LinearLayout>\n<\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Android\u306e\u753b\u9762\u4f5c\u6210\u306f\u3001\u306f\u3058\u3081\u7406\u89e3\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3072\u3068\u3064\u3072\u3068\u3064\u7406\u89e3\u3057\u3066\u3082\u3089\u3048\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Android\u3067\u306f\u3001Button(\u30dc\u30bf\u30f3)\u3001RadioButton(\u30e9\u30b8\u30aa\u30dc\u30bf\u30f3)\u3001\u30c1\u30a7\u30c3\u30af\u30dc\u30c3\u30af\u30b9(C&#8230;<\/p>\n","protected":false},"author":1,"featured_media":244,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","has-post-thumbnail","category-android","article cf"],"_links":{"self":[{"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":6,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":248,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/248"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=\/wp\/v2\/media\/244"}],"wp:attachment":[{"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hundredapps.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}