所有内置Android的布局可以在SDK中找到的下:
.../android-sdk/platforms/android-<API-VERSION>/data/res/layout/
我认为在这种情况下你正在寻找的是action_bar_title_item.xml
。
这是V19的:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:orientation="vertical"
android:paddingEnd="8dp">
<TextView android:id="@+id/action_bar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end" />
<TextView android:id="@+id/action_bar_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/action_bar_subtitle_top_margin"
android:singleLine="true"
android:ellipsize="end"
android:visibility="gone" />
</LinearLayout>
布局可以做API版本之间的差异。一般情况下,ID将会匹配,但我不能说每个布局都是如此,如果您打算使用特定的内置资源,则最好快速查看每个差异。
要做到这一点,您必须抓住源代码的单独副本来查看每个API版本。
这既可以做虽然:
显然,你只需要抓住你正在支持版本正如我上面提到的,每个文件夹都有自己的文件夹,以它的单个int版本号命名。例如:
.../android-sdk/platforms/android-19/data/res/layout/action_bar_title_item.xml
.../android-sdk/platforms/android-15/data/res/layout/action_bar_title_item.xml
.../android-sdk/platforms/android-11/data/res/layout/action_bar_title_item.xml
.../android-sdk/platforms/android-10/data/res/layout/???
呃 - 哦! API-10没有布局。如果你想在该版本的API的使用action_bar_title_item.xml
布局,可以包括和使用大侦探动作条或可能复制或修改V11布局:
.../YourApp/res/layout-v10/action_bar_title_item.xml (Eclipse)
.../YourApp/app/src/main/res/layout-v10/action_bar_title_item.xml (Android Studio)
您的电话。你可以做同样的事情,你只是想自定义布局。将内置的android版本复制到您自己的布局文件夹中,并调整为您的内容。只要注意将文件放入哪些文件夹,以便它们覆盖所需的正确版本。
Yesssss!谢谢你..要在10分钟内给出答案! – iGio90