zoukankan      html  css  js  c++  java
  • 下拉列表项的配置方式...

    1.下拉列表项的配置方式

     a:资源文件配置    

           第一步:在string.xml配置   

           <string-array name="citys">    

              <item>上海</item>    

              <item>长沙</item>        

            <item>益阳</item>   

             </string-array>     

        第二步:指定资源   

           android:entries="@array/citys"

     b:适配器配置

        第一步:资源配置  

      ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this,资源id ,列表显示的样式);

        第二步:列表配置    ArrayAdapter<CharSequence> adapte=new ArrayAdapter<CharSequence>(this,列表显示的样式,集合数据);

    2.布局方式  

    2.1LinearLayout(线性布局)

     android:orientation="vertical"

     android:layout_width="wrap_content"    //控件宽度    android:layout_height="fill_content">  //控件高度

    注意:"vertical":垂直布局 horizontal:水平布局

     wrap_content:宽度/高度和内容的宽度/高度相同  fill_content:宽度/高度是整个父组件的宽度/高度  android:layout_weight://可以指定每个控诉所占的比列

    2.2 FrameLayout(帧布局)  叠加效果

    2.3RelativeLayout (相对布局)

     android:layout_below   //在某个组件的西面

     android:layout_toLeftOf//在某个组件的左边

     android:layout_toRightOf//在某个组件的右边

     android:layout_aliginTop//与某个组件上对齐

     android:layout_aliginBottom//与某个组件下对齐

     android:layout_aliginLeft//与某个组件左对齐

     android:layout_aliginRight//与某个组件右对齐

    2.4 TableLayout(表格布局)

     注意:表格布局的组件要放在TableRow  

     2.5 AbsoluteLayout(绝对布局)

     android:layout_x:x轴坐标值

     android:layout_y:y轴坐标值

  • 相关阅读:
    docker添加sudo权限
    服务器出口ip
    flask
    ACM-奇特的立方体
    ACM-牛喝水
    ACM-可乐兑换
    ACM-Work Assignment
    ACM-DFS Template
    ACM-Checker Challenge
    ACM-Divide Tree
  • 原文地址:https://www.cnblogs.com/xuling123/p/6879512.html
Copyright © 2011-2022 走看看