标签: actionmode

AppCompat工具栏:在ActionMode中更改溢出图标颜色

使用AppCompat工具栏,我希望能够在ActionMode更改时更改溢出菜单图标的颜色.

例如,在正常工具栏模式下,溢出图标将为白色.并且会在ActionMode上变黑.到目前为止,我已经设法改变了动作模式的背景以及标题文本.但我还没有找到一种方法来改变溢出菜单图标的颜色.

我知道有一个答案: 更改ActionMode Overflow图标

我尝试了第一个解决方案,但我无法找到溢出图标.

第二种解决方案,即使延迟50L,也会导致溢出菜单图标闪烁ActionMode的预期颜色,短时间内非常刺耳.

android toolbar overflow android-appcompat actionmode

26
推荐指数
6
解决办法
3万
查看次数

如何在Android中更改ActionMode背景颜色

我正在创建一个Android应用程序,其中支持级别api是7所以我使用sherlock actionbar.我正在使用动作模式.问题是我想改变动作模式的背景.所以我试过了

    <item name="android:background">@color/something</item>
    <item name="android:backgroundStacked">@color/something</item>
    <item name="android:backgroundSplit">@color/something</item>
Run Code Online (Sandbox Code Playgroud)

这些风格的解决方案可用,但它们都不起作用. http://i43.tinypic.com/2nriic1.png

android actionbarsherlock android-actionbar actionmode android-actionmode

16
推荐指数
3
解决办法
3万
查看次数

按下工具栏的动作模式栏

在我的应用程序中,我正在使用官方文档中解释的工具栏(v7 appcompat 支持库,Theme.Appcompat.Light.NoActionBar, android.support.v7.widget.Toolbar, setSupportActionBar(myToolbar))http : //developer.android.com/training/appbar/index.html

我有一个ExpandableListView,我想在我长按一个项目时实现上下文操作模式。为了实现这一点,我使用: setMultiChoiceModeListener(new MultiChoiceModeListener())。但是这样一来,动作模式栏显示在屏幕顶部,按下Toolbar(我认为是因为系统使用的是普通动作模式,而不是支持动作模式)。我希望它显示在工具栏上。

我试过这个解决方案:

windowActionBarOverlay = true
Run Code Online (Sandbox Code Playgroud)

但它不起作用。

android toolbar android-actionbar actionmode

7
推荐指数
2
解决办法
825
查看次数

透明状态栏涵盖Kitkat上的操作模式

我对片段有一个活动.从这个片段我调用方法来显示Contextual Action Bar,这是我的问题.

样式:

<style name="MyThemeLight" parent="@android:style/Theme.Holo.Light.NoActionBar">
    <item name="android:actionModeCloseButtonStyle">@style/MyCloseButton</item>
    <item name="android:actionModeStyle">@style/ContextualBar.Light</item>
    <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
    <item name="android:actionBarStyle">@style/MyMainActionBar</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:actionModeCloseDrawable">@drawable/close_white</item>
    <item name="android:windowActionModeOverlay">true</item>
    <item name="android:windowBackground">@color/background</item>
    <item name="android:dropDownListViewStyle">@style/PopupMenuLight</item>
</style>

<style name="MyMainActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/ab_bottom_solid_dark_holo</item>
    <item name="android:height">1dp</item>  </style>


<style name="ContextualBar.Light" parent="android:style/Widget.Holo.ActionMode">
    <item name="android:background">@drawable/ab_bottom_solid_dark_holo</item>
    <item name="android:height">56dp</item>     </style>

<style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">@drawable/menu_white</item>    </style>  

<style name="MyCloseButton" parent="android:style/Widget.ActionButton.CloseMode">
    <item name="android:textColor">#000000</item>   </style>    
</resources>
Run Code Online (Sandbox Code Playgroud)

布局:

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layoutright"
    android:layout_width="fill_parent"
    android:layout_height="match_parent">

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layoutleft"
    android:layout_width="fill_parent"
    android:layout_height="match_parent">
    <!-- The main content view -->
  <android.support.v4.view.ViewPager
    android:id="@+android:id/viewpager"
    android:layout_width="fill_parent" …
Run Code Online (Sandbox Code Playgroud)

android statusbar actionmode

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

操作栏强制拆分选项卡和操作模式

如何强制ActionBar分割标签(在top)和ActionMode(在bottom)?
android:uiOptions="splitActionBarWhenNarrow"没有帮助(我正在尝试宽屏模拟器)

android android-actionbar actionmode

5
推荐指数
1
解决办法
1333
查看次数

在Android中以编程方式触发操作栏菜单项

我在栏上有菜单项的操作栏.当我点击刷新图标时,我有显示进度条的方法.

我想加载这个活动.因此,我尝试以编程方式单击调用刷新图标项:

onOptionsItemSelected(menu.findItem(R.id.action_Refresh)); 
Run Code Online (Sandbox Code Playgroud)

我在创建菜单后调用上面的内容.

但这会在加载我的数据时给出空指针异常.如果我点击刷新按钮它工作正常,但如果我以编程方式调用它我会收到错误.

这是我有的:

 @Override
public boolean onCreateOptionsMenu(Menu menu) 
{
    this.optionsMenu = menu;
    getMenuInflater().inflate(R.menu.main, menu);

    onOptionsItemSelected(menu.findItem(R.id.action_Refresh));

    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) 
{
    switch (item.getItemId()) 
    {
    case R.id.action_about:
        aboutapp();
        return true;

    case R.id.action_Refresh:
        Log.e("REfressh","Clicked");
        Mapsthree.refreshValue = 0;
        timer = new Timer();
        timerMethod();
        setRefreshActionButtonState(true);
        displayView(1);
        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

private void timerMethod()
{
    timer.scheduleAtFixedRate(new TimerTask() 
    {
        @Override
        public void run() 
        {
            updateProgressBar();
        }

    }, 0, 800);
}

private void updateProgressBar() 
{
    runOnUiThread(new Runnable() 
    { …
Run Code Online (Sandbox Code Playgroud)

android selection android-actionbar actionmode android-actionmode

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

如何在ActionMode覆盖中获取所选的webview文本

我在上下文操作菜单中添加了一些自定义菜单项.我需要使用WebView中选择的单词提供Web搜索功能.

我使用此代码覆盖ActionMode.

@Override
    public void onActionModeStarted(ActionMode mode) {
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            if (mActionMode == null) {
                mActionMode = mode;
            Menu menu = mode.getMenu();

            mode.getMenuInflater().inflate(R.menu.menu_search, menu);
        }
    }
    super.onActionModeStarted(mode);
}


public void onContextualMenuItemClicked(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_search:
            //HERE I WANT TO GET THE TEXT: HOW CAN I?
            break;
    }

    if (mActionMode != null) {
        mActionMode.finish();
    }
}
Run Code Online (Sandbox Code Playgroud)

我想使用webview中用户选择的单词搜索我的网站,但我无法获得所选文本.我怎么能得到那个,请任何人帮忙.

提前致谢.

android webview actionmode

2
推荐指数
1
解决办法
5242
查看次数

在为特定视图使用Contextual Action Bar时无法解析方法startActionMode()

我一直试图在checkBox上使用Contextual Action Bar单击以从listView中删除多行... listview在每行中都有一个复选框和一个textview.在适配器类中,我调用startActionMode(),如下所示:

**@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        View view=convertView;
        Log.v("ConvertView", String.valueOf(position));
        final ToPayModel state = toPayList.get(position);
        if (convertView == null)
        {
            inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.to_pay_item, null);
            holder = new ViewHolder();
            holder.name = (TextView) convertView.findViewById(R.id.tvToPay);
            holder.check = (CheckBox) convertView.findViewById(R.id.toPaycheck);
            convertView.setTag(holder);
            //holder.name.setOnCheckedChangeListener();
        }
        else
        {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.check.setOnClickListener( new View.OnClickListener()
        {
            public void onClick(View v)
            {
                CheckBox cb = (CheckBox) v;
                ToPayModel toPayModel = (ToPayModel) cb.getTag();
                Toast.makeText(context, "Clicked …
Run Code Online (Sandbox Code Playgroud)

android listview contextual-action-bar actionmode

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