【发布时间】:2017-05-10 08:19:54
【问题描述】:
我有一个RelativeLayout,它有TextView(第一个标签)、EditText(用于输入)、TextView(第二个标签)。我在我的项目中至少有 10 个活动有这个。我如何提取视图并制作自己的视图。所以,如果我想改变 textSize ,我只需要改变一个地方,而不是 10 处。
例如我想要这个
<RelativeLayout
android:width="match_parent"
android:height="wrap_content"
>
<TextView
android:id="firstTextView"
...
android:text="I like">
<EditText
android:id="edittextColor"
hint="type some color here"
... >
<TextView
android:id="secondTextView"
...
android:text="car.">
</RelativeLayout>
所以,我在很多地方都需要这样的东西。我想要的是:
<MySpecialView
firstText="I like"
colorEditTextHint="type color here"
secondText="car"/>
【问题讨论】: