最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android 中的两端对齐实例详解
时间:2017-03-06 编辑:简简单单 来源:一聚教程网
在android中的webview中,可以对文本内容进行对齐,具体方法如下
代码如下 | 复制代码 |
publicclassMainActivityextendsActivity {
@Override protectedvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
String htmlText =" %s "; String myData ="Hello World! This tutorial is to show demo of displaying text with justify alignment in WebView.";
WebView webView = (WebView) findViewById(R.id.webView1); webView.loadData(String.format(htmlText, myData),"text/html","utf-8"); } } activity_main.xml: xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="match_parent"/> |
相关文章
- Android编程之交互对话框实例浅析 06-26
- android判断设备是否有相机的实例代码 06-14
- Android清空编辑框内容功能的实现实例代码 06-12
- android ViewPager实现滑动翻页效果实例代码 06-10
- Android 广播监听网络状态详解及实例代码 05-03
- Android ToolBar整合实例使用方法详解 04-11