第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

只有文字沒(méi)有圖片,有誰(shuí)知道嗎

public class MainActivity extends ActionBarActivity {

? ? private GridView gridview;

? ? private List<Map<String, Object>>dataList;

? ? private int[]jpg={R.drawable.a,R.drawable.b,R.drawable.c,R.drawable.d,R.drawable.e,R.drawable.f,

? ? ? ? ? ? ?R.drawable.g,R.drawable.h,};

? ? private String[]text={"1號(hào)美女","2號(hào)美女","3號(hào)美女","4號(hào)美女","5號(hào)美女","6號(hào)美女","7號(hào)美女","8號(hào)美女"};

? ? private SimpleAdapter simpleadapter;

? ? @Override

? ? protected void onCreate(Bundle savedInstanceState) {

? ? ? ? super.onCreate(savedInstanceState);

? ? ? ? setContentView(R.layout.activity_main);

? ? ? ? gridview=(GridView) findViewById(R.id.gridView1); ??

? ? ? ? /*

? ? ? ? ?* 數(shù)據(jù)源

? ? ? ? ?* 適配器

? ? ? ? ?* 加載

? ? ? ? ?* 監(jiān)聽(tīng)

? ? ? ? ?*/

? ? ? ? dataList=new ArrayList<Map<String,Object>>();

? ? ? ? ?getData();

? ? ? ? ?simpleadapter=new SimpleAdapter(this, dataList, R.layout.item, new String[]{"jgp","text"}, new int[]{R.id.imageView,R.id.textView});

? ? ? ? ?gridview.setAdapter(simpleadapter);

? ? ? ? ?

? ? ? ? ?

? ? }



? ? private List<Map<String, Object>> getData() {

? ?

? ? for(int i=0;i<8;i++)

? ? {

? ? Map<String, Object>map=new HashMap<String, Object>();

? ? map.put("jpg", jpg[i]);

? ? map.put("text", text[i]);

? ? dataList.add(map);

? ? }

return dataList;

// TODO Auto-generated method stub

}

}

正在回答

2 回答

android studio中圖片調(diào)用方式是R.mipmap.jpg[i],

圖片文件在mipmap中,用這種方式調(diào)用

0 回復(fù) 有任何疑惑可以回復(fù)我~

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

? ? android:layout_width="match_parent"

? ? android:layout_height="match_parent"

? ? android:orientation="vertical"?

? ? android:gravity="center"

? ? android:background="#000000"

? ? >


? ? <ImageView

? ? ? ? android:id="@+id/imageView"

? ? ? ? android:layout_width="wrap_content"

? ? ? ? android:layout_height="wrap_content"

? ? ? ? android:src="@drawable/a"?

? ? ? ? />


? ? <TextView?

? ? ? ? android:id="@+id/textView"

? ? ? ? android:layout_width="wrap_content"

? ? ? ? android:layout_height="wrap_content"

? ? ? ? android:text="文字"

? ? ? ? android:textSize="20sp"

? ? ? ? android:textColor="#ffffff"

? ? ? ? />

</LinearLayout>


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Android攻城獅的第二門課(第1季)
  • 參與學(xué)習(xí)       111140    人
  • 解答問(wèn)題       1560    個(gè)

本課程由淺入深地帶您學(xué)會(huì)Android的常用控件的開(kāi)發(fā)和使用

進(jìn)入課程

只有文字沒(méi)有圖片,有誰(shuí)知道嗎

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)