zoukankan      html  css  js  c++  java
  • android学习(3)

    1.Spinner(下拉列表框)

      1.1下拉列表框的配置方式

        a.资源文件配置

          第一步:在string.xml配置
          

            <string-array name="ctiy">
              <item>赫山区</item>
            </string-array>
          第二步:指定资源
                android:entries="@array/ctiy";
        b.适配器配置
            第一种:资源配置
            ArrayAdapter<CharSequence> adapter=
            ArrayAdapter.createFromResource
            (this, 资源id, android.R.layout.simple_spinner_dropdown_item);//列表显示的样式
            第二种:列表配置
            ArrayAdapter<CharSequence> adapte=new
            ArrayAdapter<CharSequence>
            (this, android.列表显示的样式, 集合数据);

    2.布局方式

        2.1 LinearLayout(线性布局)
        android:orientation="vertical" //布局
        android:layout_width="fill_parent" //控件宽度
        android:layout_height="fill_parent" //控件高度
      注意:"vertical":垂直布局 horizontal:水平布局
          wrap_content:宽度/高度 和内容的宽度/高度相同
          fill_parent:宽度/高度是整个父组件的宽度/高度

         2.2 FrameLayout(帧布局)

            效果:是将其中的所有控件都叠加在一起。

        2.3 TableLayout(表格布局)

            TableLayout是采用表格的形式对控件的布局进行管理

            不过所有的组件要在TableRow中增加

          <TableLayout

                  

          android:layout_width="fill_parent"
          android:layout_height="wrap_content"

            <TableRow>

              

        <TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
      />

             </TableRow>

          </TableLayout>

  • 相关阅读:
    .NET泛型中的协变与逆变
    使用 Roslyn引擎动态编译代码
    Windows 自动更新服务恢复
    She Left Her Shoes
    .NET Core 配置
    EFCore中SQLSERVER 2008 的分页问题
    SQL SERVER 2012/ 2014 分页,用 OFFSET,FETCH NEXT改写ROW_NUMBER的用法(转)
    TFS命令行操作
    负载均衡(Load Balancing)学习笔记(三)
    负载均衡(Load Balancing)学习笔记(二)
  • 原文地址:https://www.cnblogs.com/etid/p/6874542.html
Copyright © 2011-2022 走看看