Android学习第一课

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/F_Felix/article/details/50813339
<span style="font-size:18px;"><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
</LinearLayout></span>


orientation有两个属性:vertical(垂直) 和 horizontal(水平)

<span style="font-size:18px;">android:layout_width="match_parent"
android:layout_height="match_parent"</span>
android:layout_width  和 android:layout_height都有两个属性:match_parent (铺满父容器 fill the screen)和 wrap_content(自适应 the view should be only as big as needed to fit the contents of the view


 <EditText android:id="@+id/edit_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />


android:hint="....."(默认输入信息,当焦点在EditText上后,这些文字就会消失)


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
    <EditText android:id="@+id/edit_message"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send" />
</LinearLayout>


猜你喜欢

转载自blog.csdn.net/F_Felix/article/details/50813339