Reputation:
How can I add a text size code here to reduce the default size. Thanks in advance.
package com.xxx;
public class Score extends AppCompatActivity {
ListView lstView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score_main);
mainView = (ListView)findViewById(R.id.mainRanking);
DbHelper db = new DbHelper(this);
List<Ranking> mainRanking = db.getRanking();
if(mainRanking.size() > 0)
{
CustomAdapter adapter = new CustomAdapter(this,mainRanking);
lstView.setAdapter(adapter);
}
}
}
Upvotes: 0
Views: 28
Reputation: 54194
Add this to your styles.xml
:
<style name="ListViewTheme">
<item name="android:textSize">12sp</item>
</style>
And then add this to your ListView
tag:
<ListView
android:id="@+id/mainRanking"
android:theme="@style/ListViewTheme"
.../>
Upvotes: 1