In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.