关于android有道词典的修改

本文介绍了一个项目的XML布局从绝对布局转换为线性布局的过程。通过使用垂直和水平的LinearLayout,提高了布局的灵活性与美观性。文章详细展示了修改后的XML代码,并介绍了各个组件如TextView、EditText、Button和WebView的具体配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文是关于第一篇博文里的项目布局的修改

将main.xml里面的绝对布局改为线性布局即可,感觉这样看起来舒服些!

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:orientation="vertical"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:padding="10px"

    android:background="@color/gainsboro"

      >

<TextView

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    android:textSize="18sp"

    android:text="@string/info"

    android:textColor="@color/blue"

    />

    <LinearLayout

    android:orientation="horizontal"

    android:layout_width="fill_parent"

    android:layout_height="wrap_content"

    >

<!-- 建立一個EditText -->

<EditText

android:id="@+id/myEditText1"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:textSize="18sp"

android:layout_weight="1"

/>

<!-- 建立一個Button -->

<Button

android:id="@+id/query"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:text="@string/chaxun"

android:layout_weight="2"

/>

<Button

android:id="@+id/reset"

android:layout_height="fill_parent"

android:layout_width="fill_parent"

android:text="@string/qingkong"

android:layout_weight="2"

/>

</LinearLayout>

<!-- 建立一個WebView -->

<WebView

android:id="@+id/myWebView1"

android:layout_height="fill_parent"

android:layout_width="fill_parent"

android:focusable="false"

/>

</LinearLayout>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值