如何隐藏顶部操作栏,但使用ActionBarSherlock显示拆分操作栏.我希望在顶部有Tabs,而不是这样:

Android开发者网站声明以下内容以隐藏操作栏但保留拆分操作栏:
如果您要隐藏顶部的主操作栏,因为您正在使用内置导航选项卡以及拆分操作栏,请调用setDisplayShowHomeEnabled(false)以禁用操作栏中的应用程序图标.在这种情况下,现在主动作栏中没有任何内容,所以它消失了,剩下的就是顶部的导航标签和底部的动作项,如图3中的第二个设备所示.
https://developer.android.com/guide/practices/tablets-and-handsets.html#SplitActionBar
在我的SherlockFragmentActivity中,我调用以下内容,但只有应用程序图标和标题消失,操作栏保持如下:
//Hide action bar
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
Run Code Online (Sandbox Code Playgroud)

调用会getSupportActionBar().hide()隐藏操作栏,但也会隐藏拆分操作栏.
我最近升级到OkHttp3,并注意到您无法再直接从客户端取消标签.这必须由应用程序现在处理.
这里以CHANGELOG为例:
取消批量呼叫现在是应用程序的责任. 取消按标记调用的API已被删除,并替换为更通用的机制.调度程序现在通过其runningCalls()和queuedCalls()方法公开所有正在进行的调用.您可以编写通过标记,主机或其他方式选择调用的代码,并对不再需要的调用Call.cancel().
我用我的简单实用工具方法自行回答这篇文章,以取消正在运行或排队的Call by tag.
这是我写一个小第三方库的问题.在这个图书馆里,我有一个这样的课程
public class TestClass
{
public int TestField { get; private set; }
public TestClass( )
{
TestField = 1;
}
}
Run Code Online (Sandbox Code Playgroud)
然后我有这样的类的varialbe形式
public TestClass test = new TestClass( );
Run Code Online (Sandbox Code Playgroud)
我面临的问题是像这样的usnig反射
PropertyInfo field = typeof( TestClass ).GetProperty( "TestField" );
field.SetValue( test, 2, null );
Run Code Online (Sandbox Code Playgroud)
程序员可以改变这个类的内部价值.这将是非常糟糕的事情因为它可以崩溃孔库.我的问题是什么是保护我的代码形式这种变化的最佳方法.我知道我可以使用某种bool标志,因此只能改变一个值,但这不是很好的salution有更好的一个吗?
最诚挚的问候,
Iordan
我知道在C#中,您可以轻松地创建数据类型的访问器,例如,通过执行以下操作:
public class DCCProbeData
{
public float _linearActual { get; set; }
public float _rotaryActual { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
但是我的同事建议我这样做:
public class DCCProbeData
{
private float _linearActual = 0f;
public float LinearActual
{
get { return _linearActual; }
set { _linearActual = value; }
}
private float _rotaryActual = 0f;
public float RotaryActual
{
get { return _rotaryActual; }
set { _rotaryActual = value; }
}
}
Run Code Online (Sandbox Code Playgroud)
我的方式似乎更简单,更简洁.无论采用哪种方式,有什么区别和好处?
谢谢
编辑只是一个注释,我的同事能够使用图表文件中最容易找到的"类详细信息"窗格中的"重构"选项生成"第二种方式"的代码.这样可以轻松添加许多属性,而无需手动创建访问器.
我LatLngBounds根据设备的百分比将相机设置为带有填充集的动画,width以便它可以在小型设备上运行.
这甚至可以在具有4英寸显示器的小型设备上运行,但是在Android 7.0中的多窗口模式和在此之前支持多窗口模式的设备中它会失败,例如.Galaxy S7.
我在多窗口模式下的设备上遇到以下异常:
Fatal Exception: java.lang.IllegalStateException: Error using newLatLngBounds(LatLngBounds, int, int, int): View size is too small after padding is applied.
Run Code Online (Sandbox Code Playgroud)
这是可疑代码:
private void animateCamera() {
// ...
// Create bounds from positions
LatLngBounds bounds = latLngBounds(positions);
// Setup camera movement
final int width = getResources().getDisplayMetrics().widthPixels;
final int height = getResources().getDisplayMetrics().heightPixels;
final int padding = (int) (width * 0.40); // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, …Run Code Online (Sandbox Code Playgroud) 下面的C++代码是做什么的?更具体地说,运营商是|=什么?
long liFaultFlags = 0;
for (int i = 0; i < FAULTCOUNT; i++)
{
if (faults[i] == true)
{
liFaultFlags |= (1 << i);
}
}
return liFaultFlags;
Run Code Online (Sandbox Code Playgroud)
如何在C#中实现?
为什么会返回错误?
public class Class1
{
public enum MyEnum
{
First,
Second,
Third
}
public MyEnum[] myEnum;
public Class1()
{
myEnum =
{
MyEnum.First,
MyEnum.First,
MyEnum.First
};
}
}
Run Code Online (Sandbox Code Playgroud)
虽然这不是:
public class Class1
{
enum MyEnum
{
First,
Second,
Third
}
public MyEnum[] myEnum =
{
MyEnum.First,
MyEnum.First,
MyEnum.First
};
public Class1()
{
}
}
Run Code Online (Sandbox Code Playgroud)
我想第一种方式,所以我可以将初始化分离到构造函数.这怎么做得好?
我有一个奇怪的问题,我的客户端在从我的WCF服务调用方法时会挂起.现在真正奇怪的是,当客户端是控制台应用程序时,这不会发生.当客户端是WinForm或WPF应用程序时,它确实发生.
我创建了一个客户端库,WCF客户端可以使用它连接到服务,如下所示:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel; //needed for WCF communication
namespace DCC_Client
{
public class DCCClient
{
private DuplexChannelFactory<ServiceReference1.IDCCService> dualFactory;
public ServiceReference1.IDCCService Proxy;
public DCCClient()
{
//Setup the duplex channel to the service...
NetNamedPipeBinding binding = new NetNamedPipeBinding();
dualFactory = new DuplexChannelFactory<ServiceReference1.IDCCService>(new Callbacks(), binding, new EndpointAddress("net.pipe://localhost/DCCService"));
}
public void Open()
{
Proxy = dualFactory.CreateChannel();
}
public void Close()
{
dualFactory.Close();
}
}
public class Callbacks : ServiceReference1.IDCCServiceCallback
{
void ServiceReference1.IDCCServiceCallback.OnCallback(string id, string message, Guid …Run Code Online (Sandbox Code Playgroud) 我有一个项目是使用netTCP端点的WCF客户端.该项目编译为另一个项目引用的DLL.我使用AppSettings在本地和远程ip端点之间切换,如下所示:
public EmbeddedClient()
{
//Grab ip to use: remote or local (used for simulator)
String location = ConfigurationSettings.AppSettings["ipAddress"];
String ip = ConfigurationSettings.AppSettings[location];
//Default to localhost if no appsetting was found
if (ip == null)
ip = "localhost";
String address = String.Format("net.tcp://{0}:9292/EmbeddedService", ip);
//Setup the channel to the service...
channelFactory = new ChannelFactory<IEmbeddedService>(binding, new EndpointAddress(address));
}
Run Code Online (Sandbox Code Playgroud)
我的App.Config是我的AppSettings和WCF端点的地方:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ipAddress" value="local"/>
<!-- Replace above value to "local" (Simulator) or "remote" (Harware)-->
<add key="local" value="localhost"/>
<add key="remote" …Run Code Online (Sandbox Code Playgroud) 我换我Activity到AppCompatActivity现在呼吁invalidateOptionsMenu()在onOptionsItemSelected()不再更新菜单项,因为他们以前那样.onPrepareOptionsMenu()不叫.
我添加了以下依赖项
compile "com.android.support:appcompat-v7:22.2.1"
Run Code Online (Sandbox Code Playgroud)
并更新了我Activity的AppCompatActivity(注意只在第一次调用invalidateOptionsMenu()在onResume()作品中,其他两个不):
public class MyActivity extends AppCompatActivity {
private boolean isStopSaved;
// ...
@Override
protected void onResume() {
super.onResume();
if (/* Check DB if star should be set */) {
isStopSaved = true;
} else {
isStopSaved = false;
}
invalidateOptionsMenu(); // This updates the menu as expected
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// ...
return super.onPrepareOptionsMenu(menu); …Run Code Online (Sandbox Code Playgroud) c# ×5
android ×3
wcf ×2
android-menu ×1
app-config ×1
arrays ×1
c++ ×1
enums ×1
field ×1
java ×1
multi-window ×1
okhttp ×1
okhttp3 ×1
operators ×1
properties ×1
reflection ×1
syntax ×1
wcf-client ×1