列出的代码工作得很好,但我想要更多。
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
{
Log.i(TAG, "HelpDetailsFragment.onCreateView() getCurrentIndex(): "+getCurrentIndex());
Log.i(TAG, "HelpDetailsFragment.onCreateView() container.getChildCount() first log: "+container.getChildCount());
FrameLayout frameLayout = new FrameLayout(getActivity());
TextView headerText = (TextView) new TextView(getActivity());
// headerText.inflate(getActivity(), R.id.textView1, null);
int height = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 50, getActivity()
.getResources().getDisplayMetrics());
headerText.setHeight(height);
headerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24);
headerText.setText(HelpScreenData.HELP_HEADERS[getCurrentIndex()]);
frameLayout.addView(headerText);
return frameLayout;
}
我尝试通过注释掉的行使用 XML 文件中的值更多地自定义文本外观。但这行不通,可以/有人请帮忙吗?