プログラミング

プロおよび熱狂的プログラマーのためのQ&A


10
NumberPickerのソフトキーボードを無効にする
数値を入力するためにNumberPickerを使用しているときに(美的理由から)ソフトキーボードを無効にしようとしています。これは私のlayout-xml-codeです: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="30dp" android:layout_marginTop="30dp" > <NumberPicker android:id="@+id/repetitionPicker" android:layout_width="40dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/repetitions_short_divider" android:textAppearance="?android:attr/textAppearanceMedium" /> <NumberPicker android:id="@+id/weightPicker" android:layout_width="40dp" android:layout_height="wrap_content" android:layout_marginLeft="40dp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="@string/pounds" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> <Button android:id="@+id/saveButton" android:layout_width="wrap_content" android:layout_height="wrap_content" …

8
Intellij-新しいJava 8クラスを使用できない-エラー:「APIの使用方法が@since 1.6以降として文書化されています。」
java.lang.function.FunctionJava 8コードベースでを使用しようとしていますが、Intellijで次のエラーが発生します。 @since 1.6+として文書化されたAPIの使用法この検査では、ドキュメントに@sinceタグが含まれるメソッドのすべての使用法が検出されます。これは、本番用のターゲットプラットフォームとして新しいSDKバージョンで開発を実行する場合に役立ちます。 プロジェクトとコンパイラの設定が正しいようです プロジェクト設定:(ファイル->プロジェクト構造) Project Settings -> Project -> Project SDK = Java 1.8 Project Settings -> Project -> Project Language Level = 8 - Lambdas, Type Annotations etc コンパイラ設定:(ファイル->設定) Build, Execution, Deployment -> Compiler -> Java Compiler -> Project Bytecode Version : 1.8 Build, Execution, Deployment -> …


10
リストのPythonリストをcsvファイルに書き込む
次の形式のリストの長いリストがあります--- a = [[1.2,'abc',3],[1.2,'werew',4],........,[1.4,'qew',2]] つまり、リストの値はさまざまなタイプ(float、int、strings)です。出力csvファイルが次のようになるようにcsvファイルに書き込む方法 1.2,abc,3 1.2,werew,4 . . . 1.4,qew,2
168 python  file  csv  file-io  python-2.7 

6
MVCでのChildActionOnlyの使用
いつ属性を使用しますChildActionOnlyか?ChildActionこの属性を使用してアクションを制限する必要があるのはどのような状況ですか?
168 c#  asp.net-mvc 

3
AngularJSに「更新」を指示するにはどうすればよいですか
カスタムディレクティブのスコープ外で発生するクリックイベントがあるため、 "ng-click"属性を使用する代わりに、jQuery.click()リスナーを使用して、スコープ内で次のように関数を呼び出します。 $('html').click(function(e) { scope.close(); ); close()は、次のような単純な関数です。 scope.close = function() { scope.isOpen = false; } 私の見解では、「ng-show」がisOpenに次のようにバインドされた要素があります。 <div ng-show="isOpen">My Div</div> デバッグ時に、close()が呼び出されていること、isOpenがfalseに更新されていることがわかりましたが、AngularJSビューは更新されていません。Angularに手動でビューを更新するように指示する方法はありますか?または、この問題を解決するために私が見ないより「角度のある」アプローチはありますか?

14
ブートストラップボタンのドロップダウンタイトルに選択したアイテムを表示する方法
次のように、アプリケーションでブートストラップドロップダウンコンポーネントを使用しています。 <div class="btn-group"> <button class="btn">Please Select From List</button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> <li><a tabindex="-1" href="#">Item I</a></li> <li><a tabindex="-1" href="#">Item II</a></li> <li><a tabindex="-1" href="#">Item III</a></li> <li class="divider"></li> <li><a tabindex="-1" href="#">Other</a></li> </ul> </div> 選択したアイテムをbtnラベルとして表示したいのですが。つまり、「リストから選択してください」を、選択されているリスト項目(「項目I」、「項目II」、「項目III」)に置き換えます。


12
静的プロパティへのバインド
単純な静的文字列プロパティをTextBoxにバインドするのに苦労しています。 これが静的プロパティを持つクラスです: public class VersionManager { private static string filterString; public static string FilterString { get { return filterString; } set { filterString = value; } } } 私のxamlでは、この静的プロパティをTextBoxにバインドしたいだけです。 <TextBox> <TextBox.Text> <Binding Source="{x:Static local:VersionManager.FilterString}"/> </TextBox.Text> </TextBox> すべてがコンパイルされますが、実行時に次の例外が発生します。 属性「Source」の値をタイプ「System.Windows.Markup.StaticExtension」のオブジェクトに変換できません。マークアップファイル「BurnDisk; component / selectversionpagefunction.xaml」のオブジェクト「System.Windows.Data.Binding」でエラーが発生しました。行57の位置29。 私が間違っていることは何か考えていますか?
168 wpf  xaml  data-binding 


16
Java多重継承
Javaの多重継承問題を解決する方法を完全に理解するために、私は明確にする必要のある古典的な質問をします。 私はクラスを持っているとしましょうAnimal、これはサブクラスを持っているBirdとHorse、私はクラスにする必要があるPegasusから延びBirdかつHorse以来、Pegasus鳥と馬の両方です。 これは古典的なダイヤモンドの問題だと思います。これを解決する古典的な方法を私が理解できることからAnimal、BirdとHorseクラスをインターフェイスにしてPegasus、それらから実装することができます。 まだ鳥や馬のオブジェクトを作成できるという問題を解決する別の方法があるのか​​と思っていました。動物を作成できる方法があれば、それも素晴らしいことですが、必須ではありません。

8
2つのJava 8ストリーム、またはストリームへの追加要素の追加
次のように、ストリームまたは追加の要素を追加できます。 Stream stream = Stream.concat(stream1, Stream.concat(stream2, Stream.of(element)); そして、次のように、新しいものを追加することができます。 Stream stream = Stream.concat( Stream.concat( stream1.filter(x -> x!=0), stream2) .filter(x -> x!=1), Stream.of(element)) .filter(x -> x!=2); しかし、concat静的であるため、これは醜いです。場合はconcat、インスタンスメソッドあったが、上記の例では、より読みやすいでしょう。 Stream stream = stream1.concat(stream2).concat(element); そして Stream stream = stream1 .filter(x -> x!=0) .concat(stream2) .filter(x -> x!=1) .concat(element) .filter(x -> x!=2); 私の質問は: 1)concat静的である理由はありますか?それとも私が見逃している同等のインスタンスメソッドがありますか? 2)いずれにしても、これを行うより良い方法はありますか?

6
Visual Studioエディターで現在の行の強調表示を無効にする
Visual Studioエディターは、現在の行の背景色を変更して現在の行を強調表示します。この強調表示を無効にする簡単な方法はありますか?それ以外の場合、[フォントと色]ダイアログのどのパラメーターが、エディターで現在選択されている線の背景色を制御しますか?


弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.