Android之实例界面设计

本文介绍了Android界面设计中的布局使用,包括LinearLayout和RelativeLayout。通过示例讲解了TextView、EditText、ImageView的属性设置,如背景、尺寸、内边距、外边距、颜色、字体大小等,并涉及焦点获取、跑马灯效果和输入限制。同时阐述了TableRow在布局中的作用,以及如何通过id进行对象引用。

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

最近很久没冒泡了。刚学Android没多久,就开始在搞界面。layout文件。

越搞才越觉得有意思。废话不多说,先送上我的layout文件,然后解说。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@drawable/background_login">
    
	<TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="15dip"
        android:paddingRight="15dip"
	android:layout_marginTop="10dip"
        android:textColor="@android:color/white" 
        android:textSize="17dip"
        android:ellipsize="marquee" 
        android:focusable="true" 
        android:marqueeRepeatLimit="marquee_forever" 
        android:focusableInTouchMode="true" 
        android:scrollHorizontally="true"
        android:text="@string/runtext"
       />
    
    <!--
       padding 内边距   layout_margin 外边距
  		android:layout_alignParentTop 布局的位置是否处于顶部
    -->

    <RelativeLayout 
        android:id="@+id/login_div"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
		android:layout_margin="17dp"
        android:background="@drawable/background_login_div_bg"
        android:padding="15dip" >  
 	              
	    <!-- 账号 -->     
		<TableRow android:layout_width="fill_parent"
			android:layout_height="wrap_content&#
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值