คำถามติดแท็ก android

Android เป็นระบบปฏิบัติการมือถือของ Google ใช้สำหรับการเขียนโปรแกรมหรือพัฒนาอุปกรณ์ดิจิตอล (สมาร์ทโฟน, แท็บเล็ต, รถยนต์, ทีวี, เครื่องแต่งกาย, แก้ว, IoT) สำหรับหัวข้อที่เกี่ยวข้องกับ Android ให้ใช้แท็กเฉพาะสำหรับ Android เช่น android-intent, android-activity, android-adapter, ฯลฯ สำหรับคำถามนอกเหนือจากการพัฒนาหรือการเขียนโปรแกรม แต่เกี่ยวข้องกับกรอบของ Android ให้ใช้ลิงค์นี้: https: // android.stackexchange.com

15
Openssl ไม่ได้รับการยอมรับว่าเป็นคำสั่งภายในหรือภายนอก
ฉันต้องการสร้างลายเซ็นแอปพลิเคชันสำหรับแอปของฉันซึ่งจะรวมเข้ากับ Facebook ในภายหลัง หนึ่งในบทเรียนของ Facebook ฉันพบคำสั่งนี้: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 ในบทช่วยสอนบอกว่าการรัน cmd นี้กระบวนการของฉันในการสร้างลายเซ็นจะเริ่มขึ้น อย่างไรก็ตามคำสั่งนี้ให้ข้อผิดพลาด: openssl is not recognized as an internal or external command ฉันจะกำจัดสิ่งนี้ได้อย่างไร


7
SparseArray กับ HashMap
ฉันคิดได้หลายสาเหตุว่าทำไมHashMaps ที่มีคีย์จำนวนเต็มดีกว่าSparseArrays: เอกสาร Android สำหรับการSparseArrayพูดว่า "โดยทั่วไปช้ากว่าแบบดั้งเดิมHashMap" หากคุณเขียนโค้ดโดยใช้HashMaps แทนSparseArrayรหัสของคุณจะทำงานร่วมกับการใช้งานแผนที่อื่น ๆ และคุณจะสามารถใช้ Java APIs ทั้งหมดที่ออกแบบมาสำหรับแผนที่ หากคุณเขียนรหัสโดยใช้HashMaps แทนSparseArrayรหัสของคุณจะทำงานในโครงการที่ไม่ใช่ Android การแทนที่แผนที่equals()และhashCode()ที่SparseArrayอื่น ๆ แต่เมื่อใดก็ตามที่ฉันพยายามใช้HashMapคีย์ที่มีจำนวนเต็มในโครงการ Android IntelliJ บอกฉันว่าฉันควรใช้SparseArrayแทน ฉันพบว่ามันยากที่จะเข้าใจ ไม่มีใครรู้เหตุผลที่น่าสนใจสำหรับการใช้งานSparseArrayของ?

13
วิธีการจับเวลาใน Android?
ฉันมี EditTexts สองรายการใน XML ในหนึ่ง EditText ผู้ใช้สามารถใส่ตัวเลขเป็นนาทีและใน EditText อื่นคือตัวเลขเป็นวินาที หลังจากคลิกปุ่มเสร็จสิ้นวินาที EditText ควรเริ่มนับถอยหลังและอัปเดตข้อความทุกวินาที นอกจากนี้ฉันจะอัปเดตมันต่อไปเรื่อย ๆ จนกว่าจะถึงศูนย์นาทีและศูนย์วินาที
177 android  timer  countdown 


8
Android Java; ฉันจะแยกวิเคราะห์ไฟล์ JSON ในเครื่องจากโฟลเดอร์ asset ลงใน ListView ได้อย่างไร
ตอนนี้ฉันกำลังพัฒนาแอพฟิสิกส์ที่ควรจะแสดงรายการสูตรและแก้ไขบางอย่าง (ปัญหาเดียวคือListView) นี่คือเค้าโครงหลักของฉัน <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:measureWithLargestChild="false" android:orientation="vertical" tools:context=".CatList" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/titlebar" > <TextView android:id="@+id/Title1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/app_name" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ff1c00" android:textIsSelectable="false" /> </RelativeLayout> <ListView android:id="@+id/listFormulas" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> </LinearLayout> และนี่คือกิจกรรมหลักของฉัน package com.wildsushii.quickphysics; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONException; import …

10
วิธีการตั้งค่า maxLength โดยทางโปรแกรมใน Android TextView?
ฉันต้องการตั้งค่าmaxLengthคุณสมบัติของโปรแกรมTextViewโดยที่ฉันไม่ต้องการให้รหัสในเค้าโครง ฉันไม่สามารถเห็นใด ๆวิธีการที่เกี่ยวข้องกับการsetmaxLength ใครช่วยแนะนำฉันให้บรรลุถึงสิ่งนี้ได้บ้าง


15
ความสูงของมุมมอง Recycler ที่ซ้อนกันไม่ได้ห่อเนื้อหา
ฉันมีแอปพลิเคชั่นที่จัดการคอลเล็กชันหนังสือ (เช่นเพลย์ลิสต์) ฉันต้องการแสดงรายการคอลเลกชันที่มีแนวตั้ง RecyclerView และในแต่ละแถวรายการของหนังสือในแนวนอน RecyclerView เมื่อฉันตั้งค่า layout_height ของ RecyclerView แนวนอนด้านในเป็น 300dp จะแสดงอย่างถูกต้อง แต่เมื่อฉันตั้งค่าเป็น wrap_content จะไม่แสดงอะไรเลย ฉันต้องใช้ wrap_content เพราะฉันต้องการที่จะสามารถเปลี่ยนการจัดการรูปแบบโดยทางโปรแกรมเพื่อสลับระหว่างการแสดงผลในแนวตั้งและแนวนอน คุณรู้หรือไม่ว่าฉันทำอะไรผิด เลย์เอาต์ของฉัน: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white"> <com.twibit.ui.view.CustomSwipeToRefreshLayout android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.RecyclerView android:id="@+id/shelf_collection_listview" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="10dp"/> </LinearLayout> </com.twibit.ui.view.CustomSwipeToRefreshLayout> </LinearLayout> เค้าโครงองค์ประกอบคอลเลกชัน: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" …

18
ปลั๊กอินเก่าเกินไปโปรดอัปเดตเป็นเวอร์ชันล่าสุดหรือตั้งค่าตัวแปรสภาพแวดล้อม ANDROID_DAILY_OVERRIDE เป็น
วันนี้ฉันเพิ่งนำเข้าแอพตัวอย่างจาก Android SDK เป็นโมดูลในโครงการของฉัน (การวิเคราะห์) และทันใดนั้นฉันก็พบข้อผิดพลาดการไล่ระดับสีเมื่อฉันพยายามซิงค์: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE envrinment variable to... นี่คือgradleไฟล์แอพของฉัน: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.0" defaultConfig { applicationId "xxx.xxxxxx.xxxxx" versionCode 1 versionName '1' minSdkVersion 9 targetSdkVersion 22 versionCode 1 versionName '1' } …

24
getActionBar () ส่งคืนค่าว่าง
ฉันมีปัญหาแปลก ๆ ฉันกำลังสร้างแอปกับ targetdk 13 ในวิธีการ onCreate ของกิจกรรมหลักของฉันฉันโทรgetActionBar()เพื่อตั้งค่าแถบการกระทำของฉัน วิธีนี้ใช้งานได้ดีเมื่อทำงานบนเครื่องจำลอง Android 3.2 แต่เมื่อใช้ Android 3.0 และ 3.1 getActionBar()วิธีการคืนค่าเป็นโมฆะ ฉันพบว่ามันแปลกมากและฉันไม่สามารถเห็นเหตุผลว่าทำไมมันถึงทำเช่นนั้น นี่เป็นข้อบกพร่องของอีมูเลเตอร์หรือมีสิ่งที่ฉันต้องทำเพื่อให้แน่ใจว่าแอปพลิเคชันของฉันมีแอ็คชั่นบาร์หรือไม่? การแก้ไข: ฉันคิดว่าฉันพบวิธีแก้ปัญหาสำหรับปัญหานี้แล้ว ฉันไม่ได้ใช้ setContentView เพื่อกำหนดเค้าโครงสำหรับกิจกรรม แต่ฉันใช้fragmentTransaction.add(android.R.id.content, mFragment, mTag)เพื่อเพิ่มส่วนย่อยให้กับกิจกรรม สิ่งนี้ใช้ได้ดีใน 3.2 แต่ในเวอร์ชันรวงผึ้งก่อนหน้านี้แถบการกระทำนั้นไม่ได้ถูกตั้งค่าหากคุณไม่ใช้ setContentView ในonCreate()วิธีการ ดังนั้นฉันจึงแก้ไขโดยใช้setContentView()วิธีในวิธีการของฉันonCreate()และเพียงแค่จัดหามันด้วยเค้าโครงที่มี FrameLayout ว่างเปล่า ฉันยังคงสามารถใช้fragmentTransaction.add(android.R.id.content, mFragment, mTag)วิธีการเช่นเดียวกับเมื่อก่อน มันไม่ใช่การแก้ไขที่สวยที่สุด แต่ใช้งานได้

13
การส่งผ่านข้อมูลระหว่างแฟรกเมนต์และกิจกรรมคอนเทนเนอร์
ฉันจะส่งผ่านข้อมูลระหว่างส่วนและกิจกรรมภาชนะได้อย่างไร มีบางสิ่งที่คล้ายคลึงกับการส่งผ่านข้อมูลระหว่างกิจกรรมผ่านจุดประสงค์หรือไม่ ฉันอ่านสิ่งนี้แล้ว แต่ก็ไม่ได้ช่วยอะไรมาก: http://developer.android.com/guide/topics/fundamentals/fragments.html#CommunicatingWithActivity

12
ความแตกต่างระหว่าง onStart () และ onResume ()
ฉันไม่สามารถรับความหมายของonStart()สถานะการเปลี่ยนแปลง วิธีการที่เรียกว่าเสมอหลังจากที่onResume() onStart()เพราะเหตุใดจึงไม่สามารถonResume()จะเรียกหลังจากที่onRestart()และonCreate()วิธีการเพียงไม่รวมonStart()? จุดประสงค์ของมันคืออะไร? onStart()ทำไมเราไม่สามารถอยู่ได้โดยไม่ต้อง ฉันยังถือว่ามันซ้ำซ้อน (อาจเป็นเพราะไม่เข้าใจความหมายของมันทั้งหมด)
176 android 

4
เพิ่มมุมมองด้านล่างแถบเครื่องมือใน CoordinatorLayout
ฉันมีเค้าโครงต่อไปนี้: <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.ActionBar"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> </android.support.design.widget.AppBarLayout> <FrameLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.design.widget.CoordinatorLayout> ฉันเพิ่มFragments เข้าไปFrameLayoutแทนที่พวกเขา หนึ่งในฉันFragmentคือรายการซึ่งมีรูปแบบต่อไปนี้: <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> ปัญหาของฉันที่นี่ที่แถบเครื่องมือจะถูกวาดขึ้นในช่วงรายการ ฉันพยายามที่จะแก้ปัญหานั้นด้วยการห่อเนื้อหาของCoordinatorLayoutลงใน a LinearLayoutที่แก้ปัญหาการถอนเงินเกิน แต่วิธีที่พฤติกรรมการเลื่อนของแถบแอปไม่ทำงานอีกต่อไป ความช่วยเหลือใด ๆ ที่ชื่นชมมาก!


โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.