小编Nev*_*uit的帖子

在TableLayout的列之间添加空格

我有一个TableLayout,我动态添加TableRows.在每个TableRow中,我添加一个Button.

我只是想在我的列之间添加一些空格(这是我的按钮)但我无法弄清楚如何...我试图改变所有可能的边距但它不起作用:(所以也许我做了我的代码中的错误,我从XML文件中膨胀它们:

private void createButtons(final CategoryBean parentCategory) {
    final List<CategoryBean> categoryList = parentCategory.getCategoryList();
    title.setText(parentCategory.getTitle());
    // TODO à revoir
    int i = 0;
    TableRow tr = null;
    Set<TableRow> trList = new LinkedHashSet<TableRow>();
    for (final CategoryBean category : categoryList) {

        TextView button = (TextView) inflater.inflate(R.layout.button_table_row_category, null);
        button.setText(category.getTitle());
        if (i % 2 == 0) {
            tr = (TableRow) inflater.inflate(R.layout.table_row_category, null);
            tr.addView(button);
        } else {
            tr.addView(button);
        }

        trList.add(tr);

        button.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                CategoryBean firstChild = category.getCategoryList() != null && …
Run Code Online (Sandbox Code Playgroud)

android divider android-tablelayout

13
推荐指数
2
解决办法
4万
查看次数

如何在c#中从库到应用程序生成回调(事件)

我正在开发一个库(DLL),我需要向用户提供事件(中断)作为一个带数据的方法.库的工作是在套接字上开始列出,从套接字接收数据并在一个方法中将此数据传递给用户.

图书馆:

public void start(string IP, int port)
{
    // start logic...

    // receives data from socket... send this data to user

}
Run Code Online (Sandbox Code Playgroud)

应用:

Library. Class a = new Library. Class();
a.start(ip, port);

// I need this method called by library automatically when it receives data...

void receivedData(string data)
{
    // data which received by library....
}
Run Code Online (Sandbox Code Playgroud)

如何用库中的数据向应用程序引发事件?

提前致谢....

c# oop dll events

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

如何为平板电脑测试创建AVD?

我可以为android 4.0.3创建一个AVD,以便我可以在模拟器上测试我的应用程序吗?我从Android SDK管理器下载了android 4.0.3 SDK.但是我如何创建AVD以便我将作为平板电脑环境运行?我发现的唯一一个是SamSung Galaxy Tab,但那是API 8.我正在寻找适用于4.0.3的东西

谢谢.

android android-virtual-device android-emulator

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

如何调用(调用)可展开列表视图的onChildClick方法?

我正在研究可扩展列表视图。我已经在子行的 imageview 上设置了 onClickHandler,因为内联点击列表在这种情况下不起作用。但我需要 int groupPosition 和 childPosition 来在我的程序中进行一些处理。这些可以从 OnChildClick() 获得。

问题是我需要 OnclickHandler 和 OnChildClick() (对于 groupPosition 和 ChildPosition)。有没有办法获得这两个值?我们可以手动调用(调用)OnChildClick 方法吗?

public class ExpList extends ExpandableListActivity
  {
       /** Called when the activity is first created. */
         @Override
         public void onCreate(Bundle icicle)
          {
            super.onCreate(icicle);
            setContentView(R.layout.main);

            getExpandableListView().setOnChildClickListener(new OnChildClickListener() 
            {
                public boolean onChildClick(ExpandableListView parent, View v,int groupPosition, int childPosition, long id) 
                {
                     // some calculations here....
                     return false;
                }
            });
  }


public void onClickHandler (View v) 
 {
     switch (v.getId()) {
         case R.id.imgcall:     

            //Here I …
Run Code Online (Sandbox Code Playgroud)

android invoke expandablelistview imageview onclicklistener

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

android webview或浏览器在设备重启时不删除会话cookie

当我重新启动我的Android设备(kindle fire)或杀死一个应用程序时,似乎浏览器或WebView'会话'cookie不会被删除.这似乎与Windows或MacOS上的浏览器行为完全不同,如果您终止浏览器应用程序,那么'会话'cookie就消失了.浏览器进程重启后,只应保留"持久性"cookie.为了澄清,这里'session cookies'的含义是服务器设置的cookie,没有到期日期,在响应中使用http头,例如:Set-Cookie:mycookie = ifmr0846qcsdpeqqkgvuqmc5u7; path = /由于没有指定过期日期,因此根据我的理解,浏览器通常不会保留这些过期日期,直到进程被终止为止.通常,使用此类型的cookie设置会话ID.

我确信这些不会在设备重启或应用程序重启时删除,因为如果我登录到我的网站,建立会话(使用非持久性/'会话'cookie作为会话ID,在这种情况下名为PHPSESSID),然后重新启动设备并打开浏览器或WebView到同一个网址,我仍然登录,这对我来说意味着浏览器仍然发送了服务器在设备重启之前设置的相同PHPSESSID cookie.

谁能解释/确认Android WebViews或浏览器的这种行为?他们如何完全管理会话和持久性cookie?

谢谢.

android session-cookies android-webview

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

在jQueryMobile中触摸后悬停效果保持不变

我正在开发用于移动设备的jQueryMobile的phonegap应用程序.我在其中搜索图标.我想在用户触摸时为该图标添加悬停效果.

我通过css实现了这个目标:

<a href="search.html" class="custom_header" >

    .custom_header:hover {
        background:url('../images/effect_glow.png') no-repeat center;
Run Code Online (Sandbox Code Playgroud)

现在问题是这种悬停效果在触摸后保持不变.我想要像mousein和mouseout这样的行为.在这种情况下,即使该部分没有接触,效果仍然存在.

手指脱落后如何去除悬停效果?

javascript css hover jquery-mobile

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

如何从我的drawable中找到imageview中设置的图像?

我需要在drawble文件夹中查找imageview(onview of imageview)中设置的图像.为此,我需要从drawable文件夹中比较drawview的imageview的背景和图像.我找到了一些方法,但在我的情况下,这些方法都不起作用.

在调试这个问题时,我发现一个名为" mBackgroundResource " 的imageview(在imageview上悬停)的一个属性在drawable文件夹中保存了我的图像的相同Integer值.

int i = R.drawable.skype; (2130837526)
Run Code Online (Sandbox Code Playgroud)

的ImageView mBackgroundResource= 2130837526

那么有没有办法获得mBackgroundResource值?所以我可以尝试比较它.谁能帮忙解决这个问题?

这是我的代码.

我在适配器中,所以,

Context mContext;
Drawable skype;

skype = mContext.getResources().getDrawable(R.drawable.skype); // in the constructor of the adapter.

public void onClick(View v)
    {   
        ImageView img = (ImageView)v.findViewById(R.id.img_call_icon);
        Drawable img_id = img.getBackground();
    }
Run Code Online (Sandbox Code Playgroud)

现在我试过了......(我错过了哪里?)

/***********************************************************************************/

    if(img_id == skype)
    {
        // Not working...
    }

/***********************************************************************************/
Bitmap bitmap = ((BitmapDrawable)img_id).getBitmap();
Bitmap bitmap1 = ((BitmapDrawable)skype).getBitmap();

if(bitmap == bitmap1)
{
    // Not working...
}
/***********************************************************************************/
Object tag = img.getTag();
int i …
Run Code Online (Sandbox Code Playgroud)

android background-image android-imageview

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

在Android模拟器中获取Internet连接

我有一个带wifi连接的台式电脑.我的IP地址是192.168.12.95,网关是192.168.10.10.但我没有在android模拟器中获得互联网连接.这是我无法访问国际.我也试过"模拟器-avd wbut -http-proxy 192.168.10.10:3128"这个命令.但有时我会在模拟器中获得连接而不做任何事情.

有人可以告诉我如何在我的Android模拟器中获得互联网连接?

connection android android-emulator

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