20
2020
09

安卓Android开发学习笔记-----更新中

看的是天哥的安卓学习视频,下面是笔记

· 完整项目最精简流程:Android <-->接口<-->数据库,

1.线性布局 LinearLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

  <LinearLayout
      android:id="@+id/ll_1"
      android:layout_width="200dp"
      android:layout_height="200dp"
      android:orientation="vertical"
      android:background="#AA55AA"
      android:paddingLeft="20dp"
      android:paddingRight="20dp"
      android:paddingBottom="50dp"
      android:paddingTop="100dp"
      android:layout_marginBottom="20dp"
      >

      <View
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="#B34D4D"
          />
  </LinearLayout>

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:orientation="horizontal"
        android:background="#E1B8B8"
        android:layout_marginTop="10dp"

    >
        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="#B34D4D"
            android:layout_weight="1"
            />
        <View
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="#B4E4E4"
            android:layout_weight="1"
            />
    </LinearLayout>
</LinearLayout>

2.相对布局 relativeLayout:下面的代码中也嵌套着线性布局,并且在线性布局中还嵌套着相对布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   >
    <View
        android:id="@+id/view_1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#C7B1E7"/>
    <View
        android:id="@+id/view_2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#C0E1B8"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"/>
    <View
        android:id="@+id/view_3"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#F5C4A3"
       android:layout_below="@id/view_1"/>
    <View
        android:id="@+id/view_4"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="#F5C4A3"
        android:layout_toRightOf="@id/view_1"/>
    <LinearLayout
        android:id="@+id/ll_1"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:background="#A0C3F8"
        android:layout_below="@id/view_3"
        android:orientation="horizontal"
        android:padding="15dp"
        >
        <View
            android:id="@+id/view_5"
            android:layout_width="100dp"
            android:layout_height="match_parent"
            android:background="#E7E7B1"
            />
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E4B4BE"
            android:padding="20dp">
            <View
                android:id="@+id/view_6"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:background="#E7E7B1"
                />
        </RelativeLayout>


    </LinearLayout>
</RelativeLayout>

3.TextView

文字大小,颜色

显示不下使用

文字+icon

中划线,下划线

跑马灯


微信扫码关注

更新实时通知

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。