In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article Xiaobian for you to introduce in detail "how to customize the Adapter display list in Android", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to customize the Adapter display list in Android" can help you solve your doubts.
Create an activitylist.xml in the res\ layout directory. The contents are as follows:
Instead of reading the Activity list from AndroidManifest.xml, we use String Array resources. Add the following Array resources to res\ value\ string.xml:
Bezier Brush Colors Font Image Path Pen Shape Transform Bezier Pattern, Gradients Colors FontDemo, FontTypes DrawMap, JumbleImage, SeeThroughImage Polys, Paths Lines, Dashes, LineCap,LineJoin Oval, Pear, Shape2DDemo Transform
Once these resources are defined, you can use a custom Adapter in the program to display the list:
Class ActivityInfo {int iconIndex; String activityName; String activityInfo;} class ActivityInfoAdapter extends ArrayAdapter {int resource; public ActivityInfoAdapter (Context context, int resourceId, List objects) {super (context, resourceId, objects); resource=resourceId;} @ Override public View getView (int position,View ConvertView,ViewGroup parent) {LinearLayout activityInfoView; ActivityInfo activityInfo=getItem (position); String activity_Name=activityInfo.activityName String activity_Info=activityInfo.activityInfo; int iconIndex=activityInfo.iconIndex; if (ConvertView==null) {activityInfoView=new LinearLayout (getContext ()); String inflater=Context.LAYOUT_INFLATER_SERVICE; LayoutInflater vi; vi= (LayoutInflater) getContext (). GetSystemService (inflater); vi.inflate (resource, activityInfoView,true);} else {activityInfoView= (LinearLayout) ConvertView } TextView activity_NameView = (TextView) activityInfoView.findViewById (R.id.activityName); TextView activity_InfoView = (TextView) activityInfoView.findViewById (R.id.activityInfo); ImageView iconView = (ImageView) activityInfoView.findViewById (R.id.iconImage); activity_NameView.setText (activity_Name); activity_InfoView.setText (activity_Info); iconView.setImageResource (iconIndex); return activityInfoView }} public class AndroidGraphics2DTutorial extends ListActivity {private ArrayList activityInfos = new ArrayList (); private ActivityInfoAdapter aa; private final static String packgeName= "com.pstreets.graphics2d"; @ Override public void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); Resources res = getResources (); String [] activity_Names = res.getStringArray (R.array.activity_name) String [] activity_Infos = res.getStringArray (R.array.activity_info); for (int item0)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.