タグ付けされた質問 「android」

AndroidはGoogleのモバイルオペレーティングシステムであり、デジタルデバイス(スマートフォン、タブレット、自動車、TV、Wear、Glass、IoT)のプログラミングまたは開発に使用されます。Androidに関連するトピックについては、android-intent、android-activity、android-adapterなどのAndroid固有のタグを使用します。開発やプログラミング以外の質問で、Androidフレームワークに関連する質問については、次のリンクを使用してください:https:// android.stackexchange.com。


10
BottomNavigationViewは常にアイコンとテキストラベルの両方を表示します
設計サポートライブラリバージョン25のandroid.support.design.widget.BottomNavigationViewを使用しています compile 'com.android.support:design:25.0.0' <android.support.design.widget.BottomNavigationView android:id="@+id/bottomBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_gravity="center" app:itemBackground="@color/colorPrimary" app:menu="@menu/bottom_navigation_main" android:forceHasOverlappingRendering="true"/> @ menu / bottom_navigation_mainに3つのアクションしかない場合は、アイコンとテキストラベルの両方が常に表示されます。 4つ以上のアクションがあるときに、アイコンとテキストラベルの両方を常に表示する方法は何ですか。

12
RecyclerView-特定の位置でアイテムの上部にスムーズにスクロールする方法は?
RecyclerViewでは、次のコマンドを使用して、選択したアイテムの一番上に突然スクロールできます。 ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, 0); ただし、これにより、アイテムが突然上位に移動します。スムーズにアイテムの先頭に移動したい。 私も試しました: recyclerView.smoothScrollToPosition(position); ただし、アイテムを一番上に選択した位置に移動しないため、うまく機能しません。位置にあるアイテムが表示されるまでリストをスクロールするだけです。


11
notifyDataSetChangeがカスタムアダプタから機能しない
を再作成するときに、ListViewから特定のメソッドを呼び出しますAdapter。 問題点: updateReceiptsListからを呼び出すAdapterと、データは更新されListViewますが、変更は反映されません。 質問: ListView電話をかけたときに新しいデータが表示されないのはなぜnotifyDataSetChangedですか? アダプター: public class ReceiptListAdapter extends BaseAdapter { public List<Receipt> receiptlist; private Context context; private LayoutInflater inflater; private DateHelpers dateH; public ReceiptListAdapter(Activity activity, Context mcontext, List<Receipt> rl) { context = mcontext; receiptlist = rl; Collections.reverse(receiptlist); inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); dateH = new DateHelpers(); } @Override public int …

13
ボタンの背景色でボタンにリップル効果を追加しますか?
ボタンを作成し、そのボタンに波及効果を追加したいと思います! ボタンbg XMLファイルを作成しました:(bg_btn.xml) <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFFFF" android:endColor="#00FF00" android:angle="270" /> <corners android:radius="3dp" /> <stroke android:width="5px" android:color="#000000" /> </shape> そして、これは私の波及効果ファイルです:(ripple_bg.xml) <ripple xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:color="#f816a463" tools:targetApi="lollipop"> <item android:id="@android:id/mask"> <shape android:shape="rectangle"> <solid android:color="#f816a463" /> </shape> </item> </ripple> そして、これは私が波及効果を追加したい私のボタンです: <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:layout_centerHorizontal="true" android:layout_marginTop="173dp" android:textColor="#fff" android:background="@drawable/ripple_bg" android:clickable="true" /> しかし、リップル効果を追加した後、ボタンの背景は透明になり、ボタンはクリックされたときのみ次のように表示されます。 クリックする前 …

8
データバインディングを使用して、リソースの文字列をXMLの動的変数と組み合わせるにはどうすればよいですか?
ハードコードされた文字列を持つTextViewがあり、この文字列の最後に配置する動的変数があります。これは私のコードです: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginLeft="16dp" android:layout_marginRight="16dp"> <TextView android:id="@+id/PeopleName" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/Generic_Text"+"@{ Profile.name }" /> </LinearLayout> で問題が発生してい android:text="@string/Generic_Text"+"@{ Profile.name }"ます。Generic_Text「私の名前は」という状態Profile.nameは動的であり、明らかにプロファイル間で変化します。TextView出力全体がMy Name is {Profile.name}になるようにしたいです。どんな助けでも素晴らしいでしょう。

25
Android Studio Gradle:タスク ':app:processDebugGoogleServices'のエラー:実行に失敗しました。>パッケージに一致するクライアントが見つかりません
Googleがここで提供する例に従って、Google Play Servicesの依存関係を8.4.0にアップグレードしようとしていますが、次のエラーが発生します(「com.example.exampleapp」はアプリパッケージ名の代わりです): Error:Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.example.exampleapp' プロジェクトbuild.gradle: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.0.0-alpha3' classpath 'com.google.gms:google-services:2.0.0-alpha3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } …

10
Recyclerviewとさまざまなタイプの行インフレの処理
新しいを使用しようとしてRecyclerViewいますが、RecyclerViewさまざまなタイプの行/カードビューが膨らむ例を見つけることができませんでした。 ListViewIオーバーライドするgetViewTypeCountとgetItemViewType、列の異なる種類を扱います。 私は「古い」方法のようにそれをすることになっていますか、LayoutManagerそれとも私は何かをするべきですか?誰かが私を正しい方向に向けることができるのかと思っていました。1つのタイプの例しか見つけられないからです。 少し違うカードのリストが欲しいのですが。またはscrollView、cardViews内部でwith を使用する必要があります...アダプターなしで作成しrecyclerViewますか?

8
Java / Android-完全なスタックトレースを出力する方法
Android(Java)で完全なスタックトレースを出力するにはどうすればよいですか?アプリケーションがnullPointerExceptionまたは何かからクラッシュした場合、次のように(ほぼ)完全なスタックトレースが出力されます。 java.io.IOException: Attempted read from closed stream. com.android.music.sync.common.SoftSyncException: java.io.IOException: Attempted read from closed stream. at com.android.music.sync.google.MusicSyncAdapter.getChangesFromServerAsDom(MusicSyncAdapter.java:545) at com.android.music.sync.google.MusicSyncAdapter.fetchDataFromServer(MusicSyncAdapter.java:488) at com.android.music.sync.common.AbstractSyncAdapter.download(AbstractSyncAdapter.java:417) at com.android.music.sync.common.AbstractSyncAdapter.innerPerformSync(AbstractSyncAdapter.java:313) at com.android.music.sync.common.AbstractSyncAdapter.onPerformLoggedSync(AbstractSyncAdapter.java:243) at com.google.android.common.LoggingThreadedSyncAdapter.onPerformSync(LoggingThreadedSyncAdapter.java:33) at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:164) Caused by: java.io.IOException: Attempted read from closed stream. at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:148) at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:159) at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:212) at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81) at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:64) at android.net.http.AndroidHttpClient.getUngzippedContent(AndroidHttpClient.java:218) at com.android.music.sync.api.MusicApiClientImpl.createAndExecuteMethod(MusicApiClientImpl.java:312) …

11
新しいTabLayoutインジケーターの色と高さを変更する方法
新しいをいじってandroid.support.design.widget.TabLayoutみたところ、クラス定義に問題があることがわかりました。インジケーターの色やデフォルトの高さを変更するメソッドはありません。 調査したところ、デフォルトのインジケーターの色はAppThemeから取得されたことがわかりました。具体的にはここから: <item name="colorAccent">#FF4081</item> さて、私の場合、を変更するとcolorAccent、この値を背景色として使用する他のすべてのビュー、たとえばProgressBarに影響します 今、indicatorColorをcolorAccent?以外の他のものに変更する方法はありますか?

5
AndroidツールバーでSearchViewを使用する方法
私が取り組んでいるコードは、を使用してToolbarを膨らませていmenuます。 これがコードです private Toolbar mToolbar; mToolbar.inflateMenu(R.menu.chat_screen_menu); setupMenu (); private void setupMenu () { mMenu = mToolbar.getMenu(); if (mMenu != null) { if (mChatPager != null && mChatPager.getCurrentItem() > 0) { mMenu.setGroupVisible(R.id.menu_group_chats, true); mMenu.setGroupVisible(R.id.menu_group_contacts, false); } else { mMenu.setGroupVisible(R.id.menu_group_chats, false); mMenu.setGroupVisible(R.id.menu_group_contacts, true); mMenu.setGroupVisible(R.id.menu_group_otr_verified,false); mMenu.setGroupVisible(R.id.menu_group_otr_unverified,false); mMenu.setGroupVisible(R.id.menu_group_otr_off,false); } } mToolbar.setOnMenuItemClickListener(new OnMenuItemClickListener () { …

5
グリッドビューの高さが切り取られます
gridview内に8つのアイテムを表示しようとしています。残念ながら、グリッドビューの高さは常に小さすぎるため、最初の行と2番目の行の一部しか表示されません。 設定android:layout_height="300dp"はそれを動作させます。wrap_でcontentあり、fill_parent明らかにそうではありません。 私のグリッドビュー: <GridView android:id="@+id/myId" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:horizontalSpacing="2dp" android:isScrollContainer="false" android:numColumns="4" android:stretchMode="columnWidth" android:verticalSpacing="20dp" /> 私のアイテムのリソース: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:minHeight="?android:attr/listPreferredItemHeight" > <ImageView android:id="@+id/appItemIcon" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@android:drawable/ic_dialog_info" android:scaleType="center" /> <TextView android:id="@+id/appItemText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="My long application name" android:gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceSmall" /> </LinearLayout> この問題は、垂直方向のスペースの不足とは関係がないようです。 私に何ができる ?
124 android  gridview 

16
キャンバスに複数行のテキストを描画する
うまくいけば、簡単な質問には、私は、私はカスタムに複数行のテキストを書きたいのですが...任意の例を見つけることができないようView経由してCanvas、そして中にonDraw()私が持っています: ... String text = "This is\nmulti-line\ntext"; canvas.drawText(text, 100, 100, mTextPaint); ... これにより改行が発生することを期待していましたが、代わりに不可解な文字\nが表示されます。 どんなポインタでも大歓迎です。 ポール

14
Gradleでビルドタイプを使用して、1つのデバイスでContentProviderを使用する同じアプリを実行する
使用しているリリースバージョンと1台の電話でデバッグバージョンを使用できるように、デバッグアプリにパッケージ名サフィックスを追加するようにGradleを設定しました。私はこれを参照していました:http : //tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types 私のbuild.gradleファイルは次のようになります。 ... android { ... buildTypes { debug { packageNameSuffix ".debug" versionNameSuffix " debug" } } } アプリでContentProviderを使い始めるまで、すべてが正常に機能します。私は得ます: Failure [INSTALL_FAILED_CONFLICTING_PROVIDER] これは、2つのアプリ(リリースとデバッグ)が同じContentProvider権限を登録しているために発生することを理解しています。 これを解決する可能性が1つあります。正しく理解できれば、ビルド時に使用する別のファイルを指定できるはずです。次に、さまざまな権限をさまざまなリソースファイル(およびマニフェストから権限を文字列リソースとして設定)に入れ、Gradleにデバッグビルドにさまざまなリソースを使用するように指示できるはずです。それは可能ですか?はいの場合、それを達成する方法に関するヒントは素晴らしいでしょう! または、Gradleを使用してマニフェストを直接変更することは可能ですか?1つのデバイスでContentProviderを使用して同じアプリを実行する方法に関する他のソリューションはいつでも歓迎します。

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