Change font size in ListView - Android/Eclipse

前端 未结 6 790
鱼传尺愫
鱼传尺愫 2020-12-13 20:28

How can I change the font size in a ListView element? In my main.xml file, I have tried several different values in for android:textSize (pt,px,sp,dp) and nothing seems to c

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 21:04

    Create another xml file for the Text that should be in the list rows..

    and just add android:layout_height="?android:attr/listPreferredItemHeight" in your TextView :D (put it in a relative layout rather than a linear layout)

    and then use your previous ListView xml for the setContentView(R.layout.listview)

    and the other xml file in your ArrayAdapter code

    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.yoursecondLayoutforthelistswithText, R.id.titles, HistoryList)

    the R.id.titles is the id for the TextView

提交回复
热议问题