我正在努力使Teamviewer成为一个有趣的软件,它允许一个人查看另一个人的屏幕并点击所有这些.无论如何,我完成了大部分套接字的工作,但我不知道如何让鼠标点击才能正常工作.这是我在网上找到的用于以编程方式移动鼠标的代码:
public static class VirtualMouse
{
// import the necessary API function so .NET can
// marshall parameters appropriately
[DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
// constants for the mouse_input() API function
private const int MOUSEEVENTF_MOVE = 0x0001;
private const int MOUSEEVENTF_LEFTDOWN = 0x0002;
private const int MOUSEEVENTF_LEFTUP = 0x0004;
private const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
private const int MOUSEEVENTF_RIGHTUP = 0x0010;
private const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
private const int MOUSEEVENTF_MIDDLEUP …Run Code Online (Sandbox Code Playgroud) 在下图中是我的列表视图下方和我的按钮上方的灰色区域.我希望该区域具有与列表相同的背景颜色(黑色).
对我来说似乎很奇怪的是,在模拟器中它是黑色的,但在我的手机上,它是灰色的.

我已经尝试设置布局,列表和cachecolorhint的背景颜色......无论如何,它都保持灰色.
目前的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="27dp"
android:layout_alignParentTop="true"
android:layout_gravity="center|center_vertical"
android:gravity="center"
android:textColor="#00ccff"
android:textSize="20dp" />
<TextView
android:id="@+id/horizontalline"
android:layout_width="match_parent"
android:layout_height="2dip"
android:layout_below="@id/header"
android:background="#8b8b8b"
android:paddingBottom="2dip"
android:paddingTop="2dip" />
<Button
android:id="@+id/AddButton"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:gravity="center|top"
android:textSize="12dp" >
</Button>
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/horizontalline"
android:background="#000000"
android:cacheColorHint="#000000"
android:layout_above="@id/AddButton"
android:drawSelectorOnTop="false"
android:listSelector="@android:color/transparent" />
<TextView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header"
android:gravity="center" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
任何帮助赞赏.
编辑
要清楚,当列表填满屏幕时,我对列表没有任何问题,只有少数几个项目没有填满屏幕我得到这个灰色背景...我更喜欢它是相同的黑色背景列表.
我想将String转换为Datetime.我收到了一个错误This is not a valid datetime.
我要转换的字符串和代码如下.
string date1 = "9/13/2012 5:26:06 PM";
TimePart = DateTime.ParseExact(date1, "M/d/yyyy HH:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);
Run Code Online (Sandbox Code Playgroud) 我一直在寻找一种方法来使用Fragment和它自己的"屏幕".
我的情景:
FragmentActivity - > layout:带有以下选项卡的选项卡主机:主页| 网络| 饲料
HomeFragment - >布局:有2个按钮,我需要为这些按钮创建一个屏幕,但我不知道该怎么做,也许隐藏显示的元素,只显示我需要的元素在"按钮屏幕"
NetworkFragment - > layout:n个按钮和n个屏幕
选项卡主机工作正常,我可以在我的选项卡(片段)之间切换,但是在片段屏幕上,我需要单击该按钮并显示除片段选项卡屏幕之外的其他屏幕.