小编Ham*_*boh的帖子

ellipsize在android中意味着什么?

我在EditText我的布局中添加了一个,并添加了一个提示,并使其水平居中.

运行应用程序时,提示是不可见的.我发现我应该做ellipsizeTextViewstart:

<EditText
    android:id="@+id/number1EditText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="start"
    android:ems="10"
    android:gravity="center_horizontal"
    android:hint="@string/hint1" />
Run Code Online (Sandbox Code Playgroud)

在Android文档中,我读到:

如果设置,则导致比视图宽的单词被
椭圆化而不是在中间断开.

问题是ellipsize在字典中找不到.任何人都可以向我解释一下我们可以通过ellipsize属性获得哪些好处?和之间有什么区别start,end,middle

android textview android-layout

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

Android:正面,负面和中性按钮之间的区别

正面,负面和中性按钮之间是否存在功能差异,特别是在AlertDialogs的上下文中?

android button android-alertdialog

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

在Android中获取布局inflater的正确方法是什么?

有一种方法可以获得layoutInflater:

LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Run Code Online (Sandbox Code Playgroud)

另一种方式是:

LayoutInflater inflater = LayoutInflater.from(context);
Run Code Online (Sandbox Code Playgroud)

第三个(当我参加活动时)是:

LayoutInflater inflater = getLayoutInflater();
Run Code Online (Sandbox Code Playgroud)

那么他们之间有什么区别?

请注意,当我将第三个inflater发送到我的适配器时,我的应用程序工作.但是当我发送上下文并通过第二种方式创建了inflater时,它没有!

java android layout-inflater

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

使用HttpUrlConnection获取"已连接"的Android POST请求

我正在尝试使用HttpUrlConnection进行POST调用,但没有成功.我经常收到'IllegalStateException:已连接'错误消息.我对重用连接不感兴趣.请检查我的代码并告诉我,如果我做错了什么:

public static final int CONNECTION_TIME_OUT = 10000;

public SimpleResponse callPost(String urlTo, Map<String, String> params) {
    System.setProperty("http.keepAlive", "false");
    HttpURLConnection conn = null;
    SimpleResponse response = new SimpleResponse(0, null);
    try {
        URL url = new URL(urlTo);
        conn = (HttpURLConnection) url.openConnection();
        conn.setUseCaches(false);
        conn.setAllowUserInteraction(false);
        conn.setConnectTimeout(CONNECTION_TIME_OUT);
        conn.setReadTimeout(CONNECTION_TIME_OUT);
        conn.setInstanceFollowRedirects(false);
        conn.setRequestMethod("POST");
        conn.setRequestProperty("Connection", "close");
        conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
        conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
        conn.setDoOutput(true);

        OutputStream os = conn.getOutputStream();
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
        writer.write(paramsToString(params));
        writer.flush();
        writer.close();
        os.close();

        int responseCode = conn.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            InputStream in = conn.getInputStream(); …
Run Code Online (Sandbox Code Playgroud)

post android httpurlconnection

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

android自定义列表视图背景焦点状态不起作用

我正在尝试为我的ExpandableListView创建自定义背景选择器.它适用于除焦点以外的所有州.我无法确定当前关注哪一行.这是代码:

im_selector.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_focused="true"
        android:drawable="@drawable/list_selector_background_focus" />
    <item android:state_pressed="true"
        android:drawable="@drawable/list_selector_background_pressed" />

    <item 
        android:drawable="@drawable/list_bg" />

</selector>
Run Code Online (Sandbox Code Playgroud)

我的列表视图在布局文件中

<ExpandableListView android:id="@+id/android:list"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:scrollbars="horizontal"
              android:layout_below="@id/top_bar"
              android:layout_marginBottom="45px"
              android:divider="#00000000"
              android:cacheColorHint="#00000000"
              android:listSelector="@layout/im_selector"
              android:focusable="true"              
            />
Run Code Online (Sandbox Code Playgroud)

android

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

如何在WP7中的画布外面隐藏控件?

我正在使用WP7 silverlight进行游戏.一些控件正在移动,并且在某些时候它们会进入它们所在的画布之外.

我想知道他们为什么不隐藏?

在窗体中,当控件进入面板时,例如:

control.left > panel.width
Run Code Online (Sandbox Code Playgroud)

它消失了.Silverlight可以实现吗?

谢谢..

silverlight canvas windows-phone-7

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

android中的setBackgroundColor

在此输入图像描述

在这个简单的游戏中,我想改变我按下的按钮的背景颜色.但是我得到以下结果,按钮外观变得不好(形状变得不同):

pressedButton.setBackgroundColor(Color.RED);
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法呢?谢谢.

[编辑:我的完整代码]

package com.example.xo_game;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.Color;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {

    Button[] btns;
    char[][] gameState = new char[3][3];
    char turn = 'X';

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button[] btns = new Button[9];

        btns[0] = (Button) findViewById(R.id.btn1);
        btns[1] = (Button) findViewById(R.id.btn2);
        btns[2] = (Button) findViewById(R.id.btn3);

        btns[3] = (Button) findViewById(R.id.btn4);
        btns[4] = (Button) findViewById(R.id.btn5);
        btns[5] = (Button) findViewById(R.id.btn6);

        btns[6] = (Button) findViewById(R.id.btn7);
        btns[7] = (Button) findViewById(R.id.btn8); …
Run Code Online (Sandbox Code Playgroud)

layout android android-layout android-button

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

SQL Server添加字符串值时的列名无效

我是SQL Server的新手

我创建了这样的表:

CREATE TABLE Accidents (
     Id INT NOT NULL PRIMARY KEY IDENTITY,
     GUID VARCHAR(100),
     Latitude VARCHAR(100),
     Longitude VARCHAR(100),
     PhotoName VARCHAR(100)        
     )
Run Code Online (Sandbox Code Playgroud)

我已经创建了一个Web服务来向该表插入数据,如下所示:

    SqlConnection con = new SqlConnection(@"workstation id=DatabaseSample.mssql.somee.com;packet size=4096;user id=???;pwd=???;data source=DatabaseSample.mssql.somee.com;persist security info=False;initial catalog=DatabaseSample");

    public string addAccidentToDatabase(string GUID, string imageBase64String, string latitude, string longitude, string photoName)
    {
        SqlCommand cmd = new SqlCommand("INSERT INTO Accidents (GUID,Latitude,Longitude,PhotoName) VALUES ("
            + GUID + "," + latitude + "," + longitude + "," + photoName + ")", con);

        try
        {
            con.Open();
            cmd.ExecuteNonQuery(); …
Run Code Online (Sandbox Code Playgroud)

c# sql database asp.net web-services

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

如何在C#中使用热键启动程序?

我正在使用C#编写程序,用户应该是盲人.我已经做了所有事情,但我记得盲人用户无法像任何人一样启动应用程序.

因此,在C#中可以将程序添加到启动程序列表并将其发送到托盘,例如,当用户按下Esc键时,程序启动.

谢谢..

.net c# file hotkeys root

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

无法在C#中登录我的netsuite帐户

我在控制台应用程序中使用以下代码:

NetSuiteService service = new NetSuiteService();

Passport passport = new Passport();
passport.account = "TSTDRV976513";
passport.email = "hamzeh.soboh@para-solutions.com";
passport.password = "*******";

RecordRef role = new RecordRef();
role.internalId = "3";
passport.role = role;

Status status = service.login(passport).status;
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

    The request failed with the error message:

    <html><head><title>302 Moved Temporarily</title></head>
    --
    --
    </html>
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

c# soap web-services netsuite

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