【发布时间】:2011-09-28 00:09:07
【问题描述】:
((TextView)((FrameLayout)((LinearLayout)((ViewGroup)getWindow().getDecorView()).getChildAt(0)).getChildAt(0)).getChildAt(0)).setGravity(Gravity.CENTER);
我已经使用上面的代码来对齐我在center 中的活动标题,但它会给我一个错误,即“FrameLayout 无法解析为一个类型”,如果删除FrameLayout 那么它会给我LinearLayout 中的相同错误。我还通过添加以下行通过android.xml 文件更改标题栏:
<application android:label="@string/app_name">
<activity android:name=".OptionsmenuAct"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
现在我正在尝试根据我的需要align,并且还想增加title text 的大小。
我该怎么做,请帮助我............
【问题讨论】: