English 中文(简体)
创造习俗的最佳途径 Xml布局档案中的观点分类?
原标题:Best way to create a custom View class from an xml layout file?

我在一份名为“我的看法”的Xml布稿中界定了相关的语言,其中载有一些次意见(TextViews、图像意见等)。

我想提出一个称为“我”的“观点”/格言,它代表了这一相互关系,使我能够利用我确定的方法改变该次意见的特性,从而我能够从方案上将我的意见与其他意见联系起来(并检索)。

这样做的最佳方式是什么? 此时,我正在创立一个名为“我的意见”的班子,它延伸了弗拉梅拉伊特和凌驾于博莱的三座建筑商,我称之为以下方法。

LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.myview, null);
addView(view);

...... 这一工作,但这意味着我的所有亲属都载于支离破碎中,因此我认为我有额外的(unnecessary)层......

最佳回答

我确实如此。 但是,我寄出这种看法,而不是否定,而没有在母体看来添加这种看法。

LayoutInflater inflater =(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.myview, this);
问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签