安卓开发新手UI开发体会

          在一次安卓开发中我遇到了一个问题,就是在一次UI 时想让背景好看一点,于是加下.xml文件中加入了图片背景,用的是线性布局,接着又在图片上加上了几个Imagebutton按钮,然后再.java文件中添加源代码时就发现,找不到Imagebutton按钮,我就想,明明我加了按钮啊,怎么没了呢?最后通过网络到处搜集资料才发现,原来是因为布局的问题,对于线性布局来说,肯定是显示不出来的,于是修改了布局,然后就搞定了

代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/rootblock_default_bg" >


    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >


        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="vertical" >
        </LinearLayout>


        <ImageButton
            android:id="@+id/imageButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageButton1"
            android:layout_below="@+id/imageButton1"
            android:src="@drawable/logo_1" />


        <ImageButton
            android:id="@+id/imageButton3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageButton2"
            android:layout_below="@+id/imageButton2"
            android:src="@drawable/logo_2" />


        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@drawable/logo_0" />


    </RelativeLayout>
 
</LinearLayout>

我自己还是个新手,所以学习和开发过程中还会遇到很多问题,我会经常把遇到的问题写下来,大家一起分享,让其他新手不要再走太多弯路……

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值