小编nr1*_*nr1的帖子

动态地将方法/方法指定为变量

所以我有两个名为A和B的课程.

A有一个方法"public void Foo()".

B还有其他几种方法.

我需要的是B类中的变量,它将被赋予A类的Foo()方法.此变量之后应该"执行"(=>所以它应该执行A类的指定方法).

这该怎么做?

c# methods

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

Android指南针示例

我正在寻找Android的指南针示例.我需要做的就是获得正确的方位(纵向和横向模式).

我已经找到了几个样本,一些只使用Sensor.TYPE_ORIENTATION,一些使用Sensor.TYPE_ACCELEROMETER&的组合Sensor.TYPE_MAGNETIC_FIELD.

哪个是正确和常见的方式来获得轴承让我们说Android 1.6 - 4.0?

android compass-geolocation

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

AutoCompleteTextView始终保持焦点

我有2 AutoCompleteTextViews一个活动(LinearLayout)和几个additional controls(无线电组,按钮等).不知何故,AutoCompleteTextViews是never losing focus.

例如:用户单击AutoCompleteTextView,控件获得焦点.因此光标开始闪烁,显示自动完成下拉列表和键盘.这可以.但是,如果user now clicks on of the radio buttons(或另一个控件),is still blinking仍然显示AutoCompleteTextView 和键盘中的光标.

如何使焦点自动消失?

编辑: xml代码

                <AutoCompleteTextView
                android:id="@+id/ediFrom"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:singleLine="true"
                android:text="" />
Run Code Online (Sandbox Code Playgroud)

user-interface android focus

6
推荐指数
2
解决办法
8165
查看次数

Windows窗体应用程序的Web界面

我需要为Windows窗体应用程序添加一个Web界面.事实上,应用程序只有一个表单,其中包含一些标准控件(按钮,轨道栏等),它们通过串行端口向微控制器发送命令.

现在我需要或多或少具有与Web界面相同的形式.实现这一目标的最佳方法是什么?

c# winforms

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

如何获取所有联系人及其所有属性

有没有人知道一个舒适的方式来获取保存在Android设备上的所有联系人及其所有属性(姓名,电话,电子邮件......)?

我需要一个适用于Android 1.5到4.0的解决方案.

多谢

android contacts

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

UserControl:如何添加MouseWheel Listener?

我正在创建一个UserControl,如果鼠标在控件上并且MouseWheel被旋转,它应该做出反应.

目前我正在这样做,如下所示:

    public MyUserControl()
    {
        this.MouseWheel += new MouseEventHandler(MouseWheelHandler);
    }

    private void MouseWheelHandler(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        if (e.Delta > 0)
            incIndex();

        if (e.Delta < 0)
            decIndex();
    }

    protected override void OnMouseEnter(EventArgs e)
    {
        this.Focus();

        base.OnMouseEnter(e);
    }
Run Code Online (Sandbox Code Playgroud)

事实上这很好,但问题是"this.Focus();"的部分.因为它破坏了我的表单/应用程序行为.

有没有更好的方法来实现这一目标?

c# user-controls mousewheel winforms

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

LinearLayout:左边的TextViews,右边的大ImageView

我正在开发一个LinearLayout但不幸的是它没有按预期工作.目标是在左侧使用带有两个TextView(一个放在另一个下面)的LinearLayout,在右侧放置一个ImageView.

ImageView应尽可能大,TextViews应占用剩余空间.

目前我的布局XML是这样的:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_linearlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="1dp"
android:background="@drawable/background" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:layout_marginLeft="2dp"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/layout1label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:singleLine="true"
        android:text="1234"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/layout2label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="1234_label2"
        android:textSize="14dp" />
</LinearLayout>


<ImageView
    android:id="@+id/layout_image"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical"
    android:layout_margin="2dp"
    android:layout_weight="1"
    android:adjustViewBounds="true"
    android:src="@drawable/ic_launcher" />
Run Code Online (Sandbox Code Playgroud)

无效的部分:如果TextViews中的文本"太长",则ImageView会缩小.我完全想要它反过来.

有解决方案吗

layout android

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