{"id":697,"date":"2013-07-17T08:29:29","date_gmt":"2013-07-17T08:29:29","guid":{"rendered":"http:\/\/hsiunien.sinaapp.com\/?p=697"},"modified":"2013-07-17T08:29:29","modified_gmt":"2013-07-17T08:29:29","slug":"android%e4%b8%ad-textview%e8%ae%be%e7%bd%ae%e6%bb%9a%e5%8a%a8%e6%9d%a1","status":"publish","type":"post","link":"https:\/\/blog.xiunian.wang\/?p=697","title":{"rendered":"android\u4e2d TextView\u8bbe\u7f6e\u6eda\u52a8\u6761"},"content":{"rendered":"<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\">TextView\u5b9e\u73b0\u6eda\u52a8\u7684\u4e09\u79cd\u65b9\u5f0f\uff1a<\/p>\n<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\"><strong style=\"border:0px;margin:0px;padding:0px;\">1\u3001\u5d4c\u5957\u5728ScrollView\u6216\u8005HorizontalScrollView\u4e2d<\/strong><\/p>\n<div class=\"codecolorer-container xml mac-classic\" style=\"border:1px solid #9f9f9f;margin:0px 0px 10px;padding:0px;font-size:13px;line-height:1.4em;font-family:monaco, &#39;lucida console&#39;, monospace;background-color:#ffffff;overflow:auto;width:auto;\">\n<div class=\"xml codecolorer\" style=\"border:0px;margin:0px;padding:5px;line-height:1.4em;\">\u5782\u76f4\u6eda\u52a8\uff1a<br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/><span class=\"sc3\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\"><span class=\"re1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&lt;scrollview<\/span> <span class=\"re0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000cd;\">android:layout_width<\/span>=<span class=\"st0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#036a07;\">&quot;fill_parent&quot;<\/span> <\/span><br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/><span class=\"sc3\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\"> &nbsp; <span class=\"re0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000cd;\">android:layout_height<\/span>=<span class=\"st0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#036a07;\">&quot;fill_parent&quot;<\/span> <span class=\"re0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000cd;\">android:scrollbars<\/span>=<span class=\"st0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#036a07;\">&quot;vertical&quot;<\/span><span class=\"re2\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&gt;<\/span><\/span><br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/> &nbsp; &nbsp;<span class=\"sc3\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\"><span class=\"re1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&lt;textview<\/span> <span class=\"re0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000cd;\">android:text<\/span>=<span class=\"st0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#036a07;\">&quot;http:\/\/orgcent.com &#8230;&quot;<\/span><span class=\"re2\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">\/&gt;<\/span><\/span><br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/><span class=\"sc3\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\"><span class=\"re1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&lt;\/scrollview<span class=\"re2\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">&gt;<\/span><\/span><\/span><br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/><br style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\" \/><\/p>\n<p>\u6c34\u5e73\u6eda\u52a8\uff1a\u4f7f\u7528\u6807\u7b7e<span class=\"sc3\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\"><span class=\"re1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&lt;horizontalscrollview<span class=\"re2\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">&gt;<\/span><\/span><span class=\"re1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">&lt;\/horizontalscrollview<span class=\"re2\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">&gt;<\/span><\/span><\/span><\/p>\n<p dir=\"ltr\"> \u4e00\u5b9a\u8981\u6ce8\u610f\u7684\u662f ScrollView\u8981\u653e\u5230 textView\u5916\u8fb9 &nbsp;\u624d\u80fd\u751f\u6548\u5730 \u3002 &nbsp; <\/p>\n<\/div>\n<\/div>\n<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\"><strong style=\"border:0px;margin:0px;padding:0px;\">2\u3001\u8bbe\u7f6eScrollingMovementMethod<\/strong><br style=\"border:0px;margin:0px;padding:0px;\" \/>\u4ee3\u7801\u4e2d\u6dfb\u52a0\uff1a<\/p>\n<div class=\"codecolorer-container java mac-classic\" style=\"border:1px solid #9f9f9f;margin:0px 0px 10px;padding:0px;font-size:13px;line-height:1.4em;font-family:monaco, &#39;lucida console&#39;, monospace;background-color:#ffffff;overflow:auto;width:auto;\">\n<div class=\"java codecolorer\" style=\"border:0px;margin:0px;padding:5px;line-height:1.4em;\">TextView.<span class=\"me1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000a2;\">setMovementMethod<\/span><span class=\"br0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">(<\/span><span class=\"kw1\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;color:#0000ff;\">new<\/span> ScrollingMovementMethod<span class=\"br0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">(<\/span><span class=\"br0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">)<\/span><span class=\"br0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">)<\/span><span class=\"sy0\" style=\"border:0px;margin:0px;padding:0px;line-height:1.4em;\">;<\/span><\/div>\n<\/div>\n<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\">XML\u4e2d\u914d\u7f6e\uff1a<\/p>\n<div class=\"codecolorer-container xml mac-classic\" style=\"border:1px solid #9f9f9f;margin:0px 0px 10px;padding:0px;font-size:13px;line-height:1.4em;font-family:monaco, &#39;lucida console&#39;, monospace;background-color:#ffffff;overflow:auto;width:auto;\">\n<div class=\"xml codecolorer\" style=\"border:0px;margin:0px;padding:5px;line-height:1.4em;\">android:scrollbars=&quot;vertical&quot;<\/div>\n<\/div>\n<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\">\u7279\u522b\u8981\u6ce8\u610f 2\u6761\u4ef6\u540c\u65f6\u6ee1\u8db3\u624d\u80fd\u6548\u3002<strong> &nbsp; &nbsp;<\/strong><\/p>\n<p style=\"border:0px;padding:5px 0px;line-height:22px;color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;background-color:#fafafa;margin-top:0px;margin-bottom:0px;\"><strong style=\"border:0px;margin:0px;padding:0px;\">3\u3001\u4f7f\u7528Scroller\u6765\u81ea\u5b9a\u4e49TextView<\/strong><br style=\"border:0px;margin:0px;padding:0px;\" \/><span style=\"border:0px;margin:0px;padding:0px;color:red;\">\u70b9\u51fb\u67e5\u770b\uff1a<a title=\"android\u81ea\u5b9a\u4e49View-\u5782\u76f4\u6eda\u52a8\u7684TextView\" href=\"http:\/\/orgcent.com\/android-custom-vertical-scroll-textview\/\" target=\"_blank\" style=\"border:0px;margin:0px;padding:0px;color:#0088dd;text-decoration:none;\">android\u81ea\u5b9a\u4e49View-\u5782\u76f4\u6eda\u52a8\u7684TextView<\/a><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\"><br \/><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\"><br \/><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\">\u5982\u679c\u9700\u8981\u5220\u9664<\/span><span style=\"font-family:\u9ed1\u4f53, simhei;\">TextView\u7684 \u6eda\u52a8\u6761 \u53ef\u4ee5<\/span><span style=\"font-family:\u9ed1\u4f53, simhei;\"> \u8bbe\u7f6e<strong style=\"color:#333333;font-family:\u5fae\u8f6f\u96c5\u9ed1, pmingliu, verdana, arial, helvetica, sans-serif;font-size:13px;line-height:22px;border:0px;margin:0px;padding:0px;\"><span style=\"font-family:\u9ed1\u4f53, simhei;color:#FF0000;\">ScrollView<\/span> \u7684xml\u7684\u5c5e\u6027 android:scrollbars=&quot;none&quot; <\/strong><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\"><br \/><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\"><br \/><\/span><\/p>\n<p><span style=\"font-family:\u9ed1\u4f53, simhei;\"> <\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>TextView\u5b9e\u73b0\u6eda\u52a8\u7684\u4e09\u79cd\u65b9\u5f0f\uff1a 1\u3001\u5d4c\u5957\u5728ScrollView\u6216\u8005HorizontalScrollView\u4e2d \u5782\u76f4\u6eda\u52a8\uff1a&lt;scrollview android:layout_width=&quot;fill_parent&quot; &nbsp; android:layout_height=&quot;fill_parent&quot; android:scrollbars=&quot;vertical&quot;&gt; &nbsp; &nbsp;&lt;textview android:text=&quot;http:\/\/orgcent.com &#8230;&quot;\/&gt;&lt;\/scrollview&gt; \u6c34\u5e73\u6eda\u52a8\uff1a\u4f7f\u7528\u6807\u7b7e&lt;horizontalscrollview&gt;&lt;\/horizontalscrollview&gt; \u4e00\u5b9a\u8981\u6ce8\u610f\u7684\u662f ScrollView\u8981\u653e\u5230 textView\u5916\u8fb9 &nbsp;\u624d\u80fd\u751f\u6548\u5730 \u3002 &nbsp; 2\u3001\u8bbe\u7f6eScrollingMovementMethod\u4ee3\u7801\u4e2d\u6dfb\u52a0\uff1a TextView.setMovementMethod(new ScrollingMovementMethod()); XML\u4e2d\u914d\u7f6e\uff1a android:scrollbars=&quot;vertical&quot; \u7279\u522b\u8981\u6ce8\u610f 2\u6761\u4ef6\u540c\u65f6\u6ee1\u8db3\u624d\u80fd\u6548\u3002 &nbsp; &nbsp; 3\u3001\u4f7f\u7528Scroller\u6765\u81ea\u5b9a\u4e49TextView\u70b9\u51fb\u67e5\u770b\uff1aandroid\u81ea\u5b9a\u4e49View-\u5782\u76f4\u6eda\u52a8\u7684TextView \u5982\u679c\u9700\u8981\u5220\u9664TextView\u7684 \u6eda\u52a8\u6761 \u53ef\u4ee5 \u8bbe\u7f6eScrollView \u7684xml\u7684\u5c5e\u6027 android:scrollbars=&quot;none&quot;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=\/wp\/v2\/posts\/697"}],"collection":[{"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=697"}],"version-history":[{"count":0,"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=\/wp\/v2\/posts\/697\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xiunian.wang\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}