大佬教程收集整理的这篇文章主要介绍了Android ArrayList ListView / Textview-您必须为textview提供资源ID,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
从search_List.xml中删除linearLayout并仅使用textvIEw并将其放入textvIEw本身
xmlns:androID="http://scheR_861_11845@as.androID.com/apk/res/androID"
那里不需要linearLayou,也可以设置 。然后它将起作用。:)
我曾经在某一时刻进行过这项工作,所以我认为我所引用的东西有误。_regionListView似乎返回确定。我认为ArrayList中的数组是问题,因为它包含额外的空索引,但我认为我没有正确连接到ListView和TextView。
任何帮助,将不胜感激。
@H_317_2@main.javaString _region = inRegion;
ParserRegion _parserRegion = new ParserRegion();
InputStream _inputStream = getresources().openRawresource(R.raw.regions);
// Parse the Input Stream
_parserRegion.Parse(_inputStream,_region);
// Get Regions
List<PropertiesRegion> _regionList = _parserRegion.GetList();
// Create the ArrayAdapter
ArrayAdapterRegion _arrayAdapter = new ArrayAdapterRegion(getApplicationContext(),R.layout.search_list,_regionList);
// Get reference to ListView holder
ListView _regionListView = (ListView) this.findViewById(R.id.regionListView);
// Set the ListView adapter
_regionListView.setAdapter(_arrayAdapter);
Search.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://scheR_861_11845@as.android.com/apk/res/android"
android:adjustViewBounds="true"
android:BACkground="@drawable/search_BACkground"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:scaleType="centerCrop" >
<TextView
android:id="@+id/SELEctRegiontextView"
android:cachecolorHint="#00000000"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="150dip"
android:gravity="top"
android:textColor="#000000"
android:textSize="20dip"
android:textStyle="bold"
android:typeface="sans" />
<ListView
android:id="@+android:id/regionListView"
android:cachecolorHint="#00000000"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:padding="10dp" />
<Button
android:id="@+id/mainMenuButton"
android:BACkground="@drawable/button_black"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="70dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:typeface="sans"
android:textSize="18dip"
android:textStyle="bold"
android:textColor="@android:color/white"/>
</LinearLayout>
Search_list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://scheR_861_11845@as.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/regiontextView"
android:cachecolorHint="#00000000"
android:gravity="center"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:paddingLeft="10dip"
android:textColor="#000000"
android:typeface="sans"
android:textSize="20dip"
android:textStyle="bold"/>
</LinearLayout>
以上是大佬教程为你收集整理的Android ArrayList ListView / Textview-您必须为textview提供资源ID全部内容,希望文章能够帮你解决Android ArrayList ListView / Textview-您必须为textview提供资源ID所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。