gpt4 book ai didi

android - 是否可以对 Android 应用程序的应用程序名称进行两次对齐?

转载 作者:太空狗 更新时间:2023-10-29 13:33:20 24 4
gpt4 key购买 nike

我很想在 Android 应用程序的标题中实现两个对齐。根据我的要求,标题需要有一个左对齐的“名称”和一个右对齐的“版本号”。

到目前为止,我尝试做的是测试 AndroidManifest.xml 文件的应用程序标签的标签属性是否接受 html,但它似乎不接受 :(。另外一些其他类似的问题我来到知道可以使用自定义主题更改标题的样式。但这并没有回答我的问题:

"Can we have two different alignments (say left and right), or for that case two different themes, to the parts of the application name?"

P.S:下面附上了所需应用程序标题的屏幕截图。

enter image description here

最佳答案

您可以创建自定义标题栏..这是示例代码。

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.i_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.i_title);

final TextView titleLeft = (TextView) findViewById(R.id.title_left);

final TextView titleRight = (TextView) findViewById(R.id.title_right);
titleLeft.setText("Checker");
titleRight.setText("Version 5.44");

}

i_title.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
android:id="@+id/title_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="app name" />

<TextView
android:id="@+id/title_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="app version" />

</RelativeLayout>

关于android - 是否可以对 Android 应用程序的应用程序名称进行两次对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13228314/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com