English 中文(简体)
行动 B. 律师资格作为非书面意见
原标题:ActionBar custom title as ImaveView instead of TextView

我试图围绕这一点在行动区开展工作,但从我能看到的标题来看,这基本上是一份案文,但我需要树立一个形象,而不是一个简单的文字。 我试图把它定成风格的主题。

<item name="android:actionBarStyle">@style/MyActionBar</item>

然后,我界定了这种风格。

 <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/action_background</item>
    <item name="android:titleTextStyle">@style/ActionbarTitleStyle</item>
</style>

我认为,我可以界定标题的背景,但即使我不是想要的,我也可以尝试“行动”Bar.setCustomView(拖延);但实际情况是,我的行动障碍在规定的常设机构之前已经失效。 观点正在被称作,我需要列入一个基地。

PD。 我只需要关注HONEYCOMB和高级公司,如果你不建议Sherlock或Johanilson执行。

最佳回答

如果你想要图像,你可以具体说明 app和icon(它将使用而不是icon):

<application
    android:icon="@drawable/ic_launcher"
    android:logo="@drawable/logo"
    android:label="@string/app_name"
    android:name=".AppName"
    >

现在,你们有任意的形象,而不是你们的荣誉。 接下来需要做的是删除案文。 您的风格是:

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="titleTextStyle">@style/NoTitleText</item>
    <item name="android:titleTextStyle">@style/NoTitleText</item>
    <item name="subtitleTextStyle">@style/NoTitleText</item>
    <item name="android:subtitleTextStyle">@style/NoTitleText</item>     
</style>

<style name="NoTitleText">
    <item name="android:textSize">0sp</item>
    <item name="android:textColor">#00000000</item>
</style>

如果你使用《BarSherlock行动》的话,请使用<条码>项目名称=“标题TextStyle”和<条码>。

问题回答

超越权限 类似观点:

@Override
public void setContentView(int resLayoutId) {
    super.setContentView(resLayoutId);
    // TODO Set your actionbar changes here
}

或者,你可以这样做:

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@drawable/action_background</item>
    <item name="android:titleTextStyle">@style/ActionbarTitleStyle</item>
    <item name="android:displayOptions">showCustom</item>
    <item name="android:customNavigationLayout">@layout/custom_nav_layout</item>
</style>




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签