这是自定义View layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="@drawable/newbackrow"
android:clickable="true"
android:orientation="vertical" >
<TextView
android:id="@+id/txt_search_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_toLeftOf="@+id/txt_search_sport"
android:layout_weight="1"
android:focusable="false"
android:inputType="textMultiLine"
android:maxLines="2"
android:singleLine="false"
android:text="TextView"
android:textColor="@android:color/white"
android:textSize="13dp"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_search_sport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:focusable="false"
android:layout_marginLeft="10dp"
android:background="@color/red"
android:padding="0dp"
android:text="TextView"
android:textColor="@android:color/white"
android:textSize="10dp"
android:textStyle="bold" />
</RelativeLayout>
//在getview()方法中放置充气
查看完全显示但不可点击,让我建议哪里出错或者其他
** // autocompletetextview OnItemclicklistener **
search_text.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View myView, int position,
long arg3) {
Toast.makeText(getApplicationContext(), "Position = "+position, Toast.LENGTH_LONG).show();
}
}