R.layout.simple_dropdown_item_1line???

2024-02-20 21:58

本文主要是介绍R.layout.simple_dropdown_item_1line???,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在做Spinner的效果时,发现很给出的ArrayAdapter的构造方法中有一个:
public ArrayAdapter (Context context, int textViewResourceId, T[] objects)
Since:  API Level 1

Constructor

Parameters
contextThe current context.
textViewResourceIdThe resource ID for a layout file containing a TextView to use when instantiating views.
objectsThe objects to represent in the ListView.
private AutoCompleteTextView autoCompleteTextView;String[] books = new String[]{"疯狂java讲义","疯狂ajax讲义","疯狂javascripy讲义","疯狂strut22讲义"};@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.textview);autoCompleteTextView = (AutoCompleteTextView)this.findViewById(R.id.autotext);ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,books);	autoCompleteTextView.setAdapter(adapter);		}
如上述代码,用的时候突然发现R.layout.simple_dropdown_item_1line,这种布局文件是干什么用的?首先从android.R.layout可以看出它是一个layout资源,故直接进入E:\Java\android-sdk-windows\platforms\android-8\data\res\layout(我选的开发版本是android2.2,其API Version是8,故选android-8目录),找到simple_dropdown_item_1line.xml;
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
**
** Copyright 2008, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License"); 
** you may not use this file except in compliance with the License. 
** You may obtain a copy of the License at 
**
**     http://www.apache.org/licenses/LICENSE-2.0 
**
** Unless required by applicable law or agreed to in writing, software 
** distributed under the License is distributed on an "AS IS" BASIS, 
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
** See the License for the specific language governing permissions and 
** limitations under the License.
*/
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1"style="?android:attr/dropDownItemStyle"android:textAppearance="?android:attr/textAppearanceLargeInverse"android:singleLine="true"android:layout_width="match_parent"android:layout_height="?android:attr/listPreferredItemHeight"android:ellipsize="marquee" />
再进入E:\Java\android-sdk-windows\platforms\android-8\data\res\values找到attr.xml文件,可以看出此TextView的样式是dropDownItemStyle即默认的下拉条目样式;文本外观是textAppearanceLargeInverse即大反差文本。
 <!-- Default style for drop down items. --><attr name="dropDownItemStyle" format="reference" /><!-- Default style for spinner drop down items. --><attr name="spinnerDropDownItemStyle" format="reference" />


这篇关于R.layout.simple_dropdown_item_1line???的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/729659

相关文章

React+TS前台项目实战(十七)-- 全局常用组件Dropdown封装

文章目录 前言Dropdown组件1. 功能分析2. 代码+详细注释3. 使用方式4. 效果展示 总结 前言 今天这篇主要讲全局Dropdown组件封装,可根据UI设计师要求自定义修改。 Dropdown组件 1. 功能分析 (1)通过position属性,可以控制下拉选项的位置 (2)通过传入width属性, 可以自定义下拉选项的宽度 (3)通过传入classN

listView的item向左滑动实现删除

有一种删除功能是这样的: ListView的item向左滑动,实现删除功能 注释很清楚,简单明了 1.自定义LeftDeleteView.java继承HorizontalScrollView.java public class LeftDeleteView extends HorizontalScrollView { private int start;//开始滑动的位

React AntDesign Layout组件布局刷新页面错乱闪动

大家最近在使用React AntDesign Layout组件布局后刷新页面时,页面布局错乱闪动 经过组件属性的研究才发现,设置 hasSider 为 true 就能解决上面的问题,耽搁了半天的时间,接着踩坑接着加油!!! import { Layout, theme } from 'antd';import { Outlet } from "react-router-dom"impo

Simple-STNDT使用Transformer进行Spike信号的表征学习(一)数据处理篇

文章目录 1.数据处理部分1.1 下载数据集1.2 数据集预处理1.3 划分train-val并创建Dataset对象1.4 掩码mask操作 数据、评估标准见NLB2021 https://neurallatents.github.io/ 以下代码依据 https://github.com/trungle93/STNDT 原代码使用了 Ray+Config文件进行了参数搜

「R绘图」grid学习笔记之grid.layout

grid.layout用于在一个视图上创建多个图层。大部分参数都很好理解,例如nrow和ncol就是声明行和列各有多少个图层。widths和heigths则是声明行高和列宽。比较难以理解的是参数,respect的参数说明是 If a logical, this indicates whether row heights and column widths should respect each

【Rust每周一知】一种奇怪的表示 T::Item

我们都知道,Rust有一种叫 完全限定语法(fully-qualified syntax) 的东西。请看下面的例子: trait AAA {type Item;fn test();}struct Foo;impl AAA for Foo {type Item = String;fn test() {println!("a test.");}}fn main() {let f: Foo::It

微信小程序-获取swiper-item中image的值(item-id)

滑过一个图片获取该图片的id,或者打印其他的item值 只需要加:item-id="{{item.id}}" <swiper bindchange="swiperchange"><block wx:for="{{photos}}" wx:key='{{item.id}}'><swiper-item item-id="{{item.id}}"><image src='{{item.url}

java日志(slf4j, log4j, jdk4j,slf4j_simple,)

以前自学java的时候,听圣思源的张龙讲到过slf4j,由于年代过于久远,都不知道这个jar是干嘛的,直到今天做了这个笔记之后..... 先写个题外话,csdn博客怎么插入图片:在文章正文下面后看到上传附件,先把图片上传上来  然后点击 上传的图片后面的 插入就可以了哦 先了解一下文中会用到的一些概念: 1.  概念 Slf4j : 全称为Simple Logging Facade

qt开发-08_layout 布局

Qt 提供了非常丰富的布局类,基本布局管理类包括:QBoxLayout、QGridLayout、QFormL ayout 和 QStackedLayout。这些类都从 QLayout 继承而来,它们都来源于 QObject(而不是 QWi dget)。创建更加复杂的布局,可以让它们彼此嵌套完成。 其中 QBoxLayout 提供了水平和垂直的布局管理;QFormLayout 提供了将输入部件和标

NetSuite Non-Inventory Item 公司内外采购总账影响

上篇文章提到,Non-Inventory Item的科目维护会根据各个企业的实际情况而有所不同,通常情况下都涉及外部交易,即对外采购与销售;另外也涉及到公司内部的相关交易,本篇以采购为例,来看看公司内外采购交易所对应的总账影响。 首先,我们创建一个Non-Inventory Item物料,其Accounting标签下的Account维护如下: 需要注意的是,这里的Intercompany