Android layout 显示来自基本适配器android的对象
我想在使用tenantlistadapter类加载的列表下面显示并运行一个按钮。我的问题是我不知道把东西放在哪里 我的课程如下Android layout 显示来自基本适配器android的对象,android-layout,android-listview,android-adapterview,Android Layout,Android Listview,Android Adapterview,我想在使用tenantlistadapter类加载的列表下面显示并运行一个按钮。我的问题是我不知道把东西放在哪里 我的课程如下 public class TenantListAdapter extends BaseAdapter { private TenantList tenantList; private Context _context; private int selectedTenantPosition; static int selectedid;
public class TenantListAdapter extends BaseAdapter {
private TenantList tenantList;
private Context _context;
private int selectedTenantPosition;
static int selectedid;
Button boutton_facebook;
Intent browserIntent;
public TenantListAdapter(Context context, TenantList array) {
this.tenantList = array;
this._context = context;
}
...
@Override
public View getView(int position, View convertView, ViewGroup parent) {
..
}
}
view方法仅显示列表视图数据,但我希望按钮显示在列表下方。因此,将按钮放在视图中是不合适的,因为它只显示列表数据。是否有其他方法在类外调用按钮
这是我的xml文件。我希望facebook按钮显示在列表视图下方
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.3" >
<ImageView
android:id="@+id/nav_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY" />
<Button android:id="@+id/back_button"
android:layout_width="100dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:background="@android:color/transparent"/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.7"
android:background="@drawable/home_background" >
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="355dp"
android:layout_margin="10dp"
android:cacheColorHint="#00000000" />
<Button
android:id="@+id/boutton_facebook"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:drawableLeft="@drawable/f_logo"
android:gravity="center_vertical|center_horizontal"
android:text="@string/event"
android:textSize="@dimen/facebook_button_text_size"
android:textStyle="bold"
android:typeface="serif" />
</LinearLayout>
</LinearLayout>
只需做这些更改..使用下面的android:layout_=“@+id/android:list in Button Widget
android:id="@+id/boutton_facebook"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:drawableLeft="@drawable/f_logo"
android:gravity="center_vertical|center_horizontal"
android:text="@string/event"
android:textSize="@dimen/facebook_button_text_size"
android:textStyle="bold"
android:typeface="serif"
android:layout_below="@+id/android:list" />