标签:sch private size activity err code create str ble
原理和ImageLoader在Listview中的使用一样,只有下面的几点变化
主页面的布局
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="60dp" android:background="@android:color/holo_blue_light" android:gravity="center" android:text="ImagleLoager_Gridview" android:textColor="@android:color/white" android:textSize="25sp" /> <GridView android:id="@+id/gv_imageloader" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" android:horizontalSpacing="4dip" android:numColumns="3" android:padding="4dip" android:stretchMode="columnWidth" android:verticalSpacing="4dip" /> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="60dp" android:layout_height="60dp" android:orientation="horizontal"> <ImageView android:src="@drawable/ic_launcher" android:id="@+id/image" android:layout_width="50dp" android:layout_height="50dp" /> <TextView android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/holo_blue_light" android:gravity="center" android:text="ImagleLoager_Listview" android:textColor="@android:color/white" android:textSize="25sp" /> </LinearLayout>
主页面发生改变:其他都不会有变化:
package application.weiyuan.com.listviewimageloader; import android.app.Activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.GridView; import android.widget.ListView; public class MainActivity extends Activity { private GridView gridView; private ListViewAdapter listViewAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); initData(); } private void initView() { gridView = (GridView)findViewById(R.id.gv_imageloader); } private void initData() { // 创建适配器 listViewAdapter = new ListViewAdapter(MainActivity.this); // 添加适配器到listview中 gridView.setAdapter(listViewAdapter); } }
标签:sch private size activity err code create str ble
原文地址:http://www.cnblogs.com/kebibuluan/p/7242610.html