Android TextView Button 中的内容无法居中 Android中如何让控件居中
\u5982\u4f55\u4f7fdiv\u4e2ddiv\u7684\u5185\u5bb9\u5c45\u4e2d\u663e\u793a
\u8d85\u94fe\u63a5
\u5176\u4e2d
\u662f\u4e3a\u4e86\u8ba9\u8d85\u94fe\u63a5\u6362\u884c ;
padding-top:**px;\u662f\u4e3a\u4e86\u5782\u76f4\u5c45\u4e2d\uff0c\u5177\u4f53\u662f\u591a\u5c11px \uff0c\u8981\u6839\u636e\u4f60div\u7684\u9ad8\u5ea6\u6765\u786e\u5b9a\u3002
\u65b9\u6cd5\u4e00\uff1a\u8bbe\u7f6e\u7236\u5e03\u5c40\u7684\u5c5e\u6027\uff0c\u4f46\u662fframelayout\u662f\u6ca1\u6709\u5c45\u4e2d\u6548\u679c\u7684
\u7ebf\u6027\u5e03\u5c40linearlayout\u548c\u76f8\u5bf9\u5e03\u5c40relativelayout\u6bd4\u8f83\u5e38\u7528
\u4e0b\u9762\u662f\u4e24\u4e2atextview\u5728LinearLayout\u7ebf\u6027\u5e03\u5c40\u4e0b\u7684\u6548\u679c
\u53ef\u4ee5\u770b\u5230\u4e24\u4e2atextview\u5c45\u4e2d\u4e86
\u5728RelativeLayout\u4e2d\u540c\u6837\u7684\u6548\u679c
\u65b9\u6cd5\u4e8c\uff1a\u5355\u72ec\u8bbe\u7f6eview\u7684\u5c45\u4e2d\u5c5e\u6027\u4e3a
\u5728linearlayout\u4e2d\u53ea\u80fd\u662f\u5e03\u5c40\u65b9\u5411\u5c45\u4e2d\uff0c\u8bbe\u7f6eandroid:layout_gravity\u5c5e\u6027
\u5982
\u53ef\u4ee5\u770b\u5230\u53ea\u6709\u6a2a\u5411\u5c45\u4e2d
\u5728Relativelayout\u4e2d\u8bbe\u7f6eandroid:layout_inParent\u5c5e\u6027\u4e3atrue
\u53ef\u4ee5\u770b\u5230\u53ea\u6709textview1\u662f\u5c45\u4e2d\u7684
<Button
android:id="@+id/Button_MainActivity_SettingText"
android:layout_width="70dp"
android:layout_height="match_parent"
android:background="#000000"
android:gravity="center"
android:text="@string/MainActivity_TitleBarSettings" />
</LinearLayout>
扩展阅读:app download ... mega888 android ... android app store china ... zookeeper java api ... android下载安装app ... youtube android ... download android verslon ... matebook14 ... free android apks ...