小编Abh*_*Dey的帖子

Action Bar Android中徽标的中心位置

我想在Action Bar的中心显示徽标.这是我的自定义布局代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ActionBarWrapper"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/logo"
        android:layout_centerInParent="true"
        android:padding="8dp"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

onCreate()我用它作为:

getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.custom_logo);
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#2A2A2A")));
Run Code Online (Sandbox Code Playgroud)

问题是它在正常的碎片和活动中显示正常,但在与导航抽屉一起使用时向右移动一点.这是图像:

  1. 错了一个:

显示错误

  1. 正确对象,真爱:

正确显示

我究竟做错了什么?谢谢.

android android-appcompat android-actionbar

6
推荐指数
4
解决办法
1万
查看次数

如何使用c#比较字符串与另一个字符串

我有一种情况,我不想将总字符串长度与其他字符串进行比较.

例:

string MainString = "Deanna Ecker";

string SearchString = "Ecker Designs";

int value = MainString.IndexOf(SearchString);
Run Code Online (Sandbox Code Playgroud)

这里用整串搜索.但我需要在MainString中找到任何单词.不是整个字符串..

让我知道这怎么可能.

c# string

3
推荐指数
1
解决办法
116
查看次数