小编Myt*_*hul的帖子

如何在Android 5.0 Lollipop中更改ActionBar文本颜色?

如何将ActionBarAndroid Lollipop中的文本颜色更改为黑色中的白色?

这是我目前的造型.

<style name="AppCustomTheme" parent="@style/Theme.AppCompat.Light">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/orange_bar</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android android-actionbar

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

如何在C#中将DataAdapter与SqlTransaction一起使用?

我需要创建2个按钮,一个用于启动事务(startButton),一个用于提交事务(commitButton)。

我在尝试为SELECT命令实施它时陷入困境。

当我commitButton按时,我收到错误消息,该事务已经完成并且不再可用。

public void startTransaction(IsolationLevel isolationLevel) {
    connectSQL();
    connection.Open();
    transaction = connection.BeginTransaction(isolationLevel);
    Console.WriteLine("Transaction started !");
}

public void commitTransaction() {
    this.transaction.Commit();
    connection.Close();
    Console.WriteLine("Transaction commited !");
}

public DataTable readAllRezervari() {
    try {
        String selectSql = "SELECT * FROM Rezervari;";
        SqlCommand sqlCommand = new SqlCommand(selectSql, connection, transaction);
        rezervariDataAdapter.SelectCommand = sqlCommand;
        rezervariDataAdapter.Fill(rezervariDataSet, "Rezervari");
    }
    catch (Exception e) {
        Console.WriteLine("ERROR: " + e);
        try {
            transaction.Rollback();
        }
        catch (Exception e2) {
            Console.WriteLine("ERROR: " + …
Run Code Online (Sandbox Code Playgroud)

.net c# sql sql-server transactions

5
推荐指数
2
解决办法
9321
查看次数

如何逐行读取文本文件?

我无法在Windows RT(Windows 8商店)中逐行找到有关如何读取文本文件的简洁说明.

可以说我有一个文件夹: MyFolder/Notes.txt

我想从Notes.txt读取数据并将其添加到字符串数组中.

我如何从该文件读/写?之前我正在使用StreamReader,但现在它非常令人困惑.并且开发样本没有那么多帮助.

c# io windows-8 windows-runtime windows-store-apps

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

如何使用Java中的Reflection获取注释的值

如何使用Java获取注释的值Reflection

这是带注释的方法:

@JsonView( { View.class } )
public Element getElement()
{
    return element;
}
Run Code Online (Sandbox Code Playgroud)

java reflection annotations

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

SearchView没有出现在工具栏 - Android Lollipop中

我在下面的Activity中有这个工具栏:

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_select_currency"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"/>
Run Code Online (Sandbox Code Playgroud)

菜单也在以下位置声明:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item android:id="@+id/search"
      android:title="@string/search_currency"
      android:icon="@drawable/ic_action_search"
      android:showAsAction="collapseActionView|ifRoom"
      android:actionViewClass="android.support.v7.widget.SearchView"/>

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

在我打电话的活动中:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.currency_selector_options_menu, menu);

    return true;
}

private void initActionBar() {
    // Initialize the Toolbar( this is the new ActionBar in Lollipop)
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_select_currency);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(getString(R.string.select_currency));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Run Code Online (Sandbox Code Playgroud)

现在我的问题是我没有在正常的ActionBar中获得SearchView,我得到的是普通菜单.我怎样才能获得正常的SearchView?

android android-5.0-lollipop

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

@RequestBody在发出POST请求时给出空的JsonObject

我有以下方法:

@RequestMapping(value = "/app/write", method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public
@ResponseBody
Status writeBuildData(@RequestBody JsonObject templateDataJSON){}
Run Code Online (Sandbox Code Playgroud)

基本上我POST发送一个Ajax 请求发送JSON,JsonObject {}结果总是得到一个空的

JsonObject templateDataJSON = "{}";
Run Code Online (Sandbox Code Playgroud)

但如果我使用String代替JsonObject,我得到正确的值.

这个应用程序是由Spring Mvc 4.1.4制作的.

依赖关系:

compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.google.code.gson:gson:2.3.1'
Run Code Online (Sandbox Code Playgroud)

知道我错过了什么,为什么JsonObject没有注射,总是给我{}

java spring json jackson

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

如何使用Spring MVC返回文本文件?

@RequestMapping( method = RequestMethod.POST, value = DataController.RESOURCE_PATH + "/file", headers = "content-type=application/json" )
@ResponseBody
public void export( @RequestBody JSONObject json, HttpServletResponse response ) throws IOException
{
    String myString = "Hello";
}
Run Code Online (Sandbox Code Playgroud)

字符串是在里面生成的Controller.我想要的是向用户发送一个窗口,在那里他可以保存一个包含该文件的文件myString.

$.ajax({
    type: "POST",
    url: url,
    data: JSON.stringify(createJSON()),
    contentType: "application/json",
    success: function(response)
    {
        console.log("Exported JSON: " + JSON.stringify(createJSON()));
        console.log(response);
    },
    error: function()
    {
        console.log(arguments);
        alert("Export process failed.");
    }
});
Run Code Online (Sandbox Code Playgroud)

它显然在当前状态下不起作用,此刻我陷入困境.

java spring spring-mvc

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

如何将对象从帧传递到Windows 8样式应用程序中的另一个帧

我有问题,我现在无法弄清楚.我正在尝试开发一个Windows-8风格的应用程序,并且我坚持实现这个功能.

我有一个MainWindow,它包含一个ListBox和一个Button(比如说addButton).

当我单击按钮导航到新页面时,让我们说AddCustomerPage with this.Frame.Navigate(typeof(AddCustomerPage));

AddCustomerPage有1个textBox和1个按钮(比如doneButton.当我点击按钮时,我希望textBox中的字符串被添加到上一页的ListBox中.

这是我目前的功能:1.MainWindow已创建.

  1. 单击addButton

  2. AddCustomer页面已创建.MainWindow被破坏(问题).

  3. 点击doneButton

  4. 使用带有1个项目的ListBox创建MainWindow对象.

  5. 重复添加过程,我总是得到一个带有1个项目的ListBox的MainWindow.

谢谢您的帮助.这是代码:

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();

        this.brainPageController = new PageController();

        // add items from the List<String> to the listBox
        listGoals.ItemsSource = brainPageController.GetListGoals();
    }

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        var parameter = e.Parameter as String;
        // a simple controller that adds a string to a List<string>
        brainPageController.AddGoal(parameter);
    }

    private void addButton_Click(object …
Run Code Online (Sandbox Code Playgroud)

c# windows-8 windows-store-apps

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

如何在Windows应用商店应用中保存数据关闭?

我有以下问题.当用户关闭Windows应用商店应用时,我想要一个包含数据的文本文件.

我应该写什么方法,以便在关闭应用程序时保存文件?

.net c# wpf windows-runtime

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

在这个例子中,Lisp"prog"是如何工作的?

我是lisp的初学者,我需要有人向我解释一下这个prog表单的工作原理.l1的初始值是多少?没?

如果列表在第一级上具有偶数个元素,则问题输出T,否则为零.

(defun nr_par (l)
  (prog ((l1 l))
    ciclu
    (cond
      ((null l1) (return T))
      ((null (cdr l1)) (return NIL))
      ((null (cddr l1)) (return T))
      (T (setf l1 (cddr l1))
         (go ciclu)))))
Run Code Online (Sandbox Code Playgroud)

在控制台上:

(nr_par '(1 2 3 4 5 6 7 8))

T
Run Code Online (Sandbox Code Playgroud)

lisp common-lisp

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