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

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

9
จัดแนว textviews บนขอบซ้ายและขวาในเค้าโครง Android
ฉันเริ่มต้นกับ Android ฉันมีปัญหาในการรับเลย์เอาต์แบบง่าย ๆ ฉันต้องการใช้LinearLayoutตำแหน่งa ถึงสองTextViewsในแถวเดียว หนึ่งTextViewทางด้านซ้ายมืออื่น ๆ บนด้านขวามือ (คล้ายกับลอย: ซ้ายลอย: สิทธิในการ CSS) เป็นไปได้หรือไม่หรือฉันจำเป็นต้องใช้การViewGroupวางซ้อนโครงร่างที่แตกต่างออกไปเพื่อให้บรรลุผลหรือไม่ นี่คือสิ่งที่ฉันมี: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:padding="10sp"> <TextView android:id="@+id/mytextview1" android:layout_height="wrap_content" android:text="somestringontheleftSomestring" android:layout_width="wrap_content"/> <TextView android:id="@+id/mytextview2" android:layout_height="wrap_content" android:ellipsize="end" android:text="somestringontheright" android:layout_width="wrap_content"/> </LinearLayout>
158 android 

7
Android: android.content.res.Resources $ NotFoundException: ID ทรัพยากรสตริง # 0x5
ฉันได้รับการยกเว้นจากชื่อเมื่อเรียกใช้แอพของฉัน มันคืออะไรมันมีไฟล์. txt พร้อมคำสำหรับเกม Hangman และฉันคิดว่ามีข้อผิดพลาดเกิดขึ้นเมื่อเข้าถึงไฟล์ ไฟล์ของฉัน cuvinte.txt อยู่ใน / assets / นี่คือรหัสของฉัน (ฉันข้ามส่วนเค้าโครง / xml ซึ่งทำงานได้ดี): public void onCreate() { // all the onCreate() stuff, then this: try { AssetManager am = this.getAssets(); InputStream is = am.open("cuvinte.txt"); InputStreamReader inputStreamReader = new InputStreamReader(is); BufferedReader b = new BufferedReader(inputStreamReader); String rand; …
158 android  string  file 

20
เปลี่ยนสีวงกลมของปุ่มตัวเลือก
ฉันต้องการเปลี่ยนสีของวงกลมของRadioButtonในหนึ่งในโครงการของฉันฉันไม่เข้าใจว่าจะตั้งค่าคุณสมบัติใด สีพื้นหลังที่ฉันเป็นสีดำทำให้มองไม่เห็น ฉันต้องการตั้งค่าสีของวงกลมเป็นสีขาว

16
ทำไม Android Studio ถึงบอกว่า“ กำลังรอการดีบักเกอร์” หากฉันไม่ได้ทำการดีบั๊ก
ฉันทำงานกับ Android Studio ตั้งแต่เมื่อคืนเมื่อฉันเรียกใช้โครงการของฉันบนอุปกรณ์ของฉันปรากฏข้อความ "กำลังรอการดีบักเกอร์" มันเป็นพฤติกรรมที่แปลกมากเพราะฉันไม่ได้ดีบั๊กแอปพลิเคชัน ฉันพยายามถอนการติดตั้งแอปพลิเคชันออกจากอุปกรณ์ของฉันแล้วกด Run บน Android Studio ข้อความปรากฏขึ้นอีกครั้ง ฉันพยายามรีสตาร์ท Android Studio ข้อความปรากฏขึ้นอีกครั้ง วิธีเดียวในการติดตั้งแอปพลิเคชันบนโทรศัพท์ของฉันอย่างถูกต้องคือกด "ดีบั๊ก" ข้อความจะปรากฏขึ้น แต่ถูกปิดโดยอัตโนมัติ จากนั้นแอปพลิเคชันก็ใช้ได้ดี ฉันได้ลองด้วย <application android:debuggable="false" /> ... และยังปรากฏข้อความ LogCat พูดว่า: E/InputDispatcher﹕ channel ~ Channel is unrecoverably broken and will be disposed! E/Launcher﹕ Error finding setting, default accessibility to not found: accessibility_enabled …

5
ข้อโต้แย้งใดที่ถูกส่งผ่านไปยัง AsyncTask <arg1, arg2, arg3>
ฉันไม่เข้าใจสิ่งที่ฉันควรจะใส่ที่นี่และข้อโต้แย้งเหล่านี้จบลงที่ไหน? ฉันควรจะใส่อะไรดีและมันจะไปที่ไหน ฉันต้องรวมทั้ง 3 รายการหรือรวม 1,2,20 อันด้วยหรือไม่

26
เปิดหน้า Facebook จากแอพ Android หรือไม่
จากแอพ Android ของฉันฉันต้องการเปิดลิงก์ไปยังโปรไฟล์ Facebook ในแอพ Facebook อย่างเป็นทางการ (ถ้าติดตั้งแอพไว้แน่นอน) สำหรับ iPhone มีมีอยู่fb://โครงการ URL แต่พยายามในสิ่งเดียวกันบนอุปกรณ์ Android ActivityNotFoundExceptionของฉันพ่น มีโอกาสที่จะเปิดโปรไฟล์ Facebook ในแอพ Facebook อย่างเป็นทางการจากรหัสหรือไม่

12
Android emulator ไม่สามารถจัดสรรหน่วยความจำ 8 ได้
เมื่อฉันพยายามเรียกใช้ตัวจำลอง WXGA800 จาก Eclipse มันมีข้อผิดพลาดเช่นนี้ Failed to allocate memory: 8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ฉันตรวจสอบลิงก์ต่อไปนี้ด้วย ไม่สามารถจัดสรรหน่วยความจำได้: 8 Android: การจัดสรรหน่วยความจำล้มเหลว ฉันได้ลองลดขนาด RAM ในอีมูเลเตอร์และเพิ่ม Java heapsize และ ramsize แต่ยังฉันก็พบข้อผิดพลาดเดียวกัน

12
เราจะใช้ runOnUiThread ใน Android ได้อย่างไร
ฉันใหม่สำหรับ Android และฉันพยายามใช้ UI-Thread ดังนั้นฉันจึงเขียนกิจกรรมทดสอบอย่างง่าย แต่ฉันคิดว่าฉันเข้าใจผิดบางอย่างเพราะเมื่อคลิกปุ่ม - แอพไม่ตอบสนองอีกต่อไป public class TestActivity extends Activity { Button btn; int i = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { runThread(); } }); } private void runThread(){ runOnUiThread (new Thread(new …
157 android  ui-thread 

16
Application Error - การเชื่อมต่อกับเซิร์ฟเวอร์ไม่สำเร็จ (ไฟล์: ///android_asset/www/index.html)
แอป Dies On Startup (การเชื่อมต่อกับเซิร์ฟเวอร์ไม่สำเร็จ) ฉันมีแอพพลิเคชั่น Android ที่ฉันเขียนโดยใช้ PhoneGap BUILD แอปทำงานได้ดีก่อนหน้านี้ แต่ตอนนี้ดูเหมือนว่าฉันได้รับข้อผิดพลาดนี้หลังจากปรับแต่งแอปของฉัน (การเปลี่ยนแปลง UI บางอย่างเท่านั้น) 1) เมื่อฉันเริ่มแอพที่ฉัน (ปกติ) จะได้รับ: Application Error - การเชื่อมต่อกับเซิร์ฟเวอร์ไม่สำเร็จ (ไฟล์: ///android_asset/www/index.html) ขออภัยหากคำถามนี้ซ้ำซ้อน ฉันได้เห็นคำถามที่คล้ายกันที่นี่ แต่ฉันไม่พบคำตอบหรือวิธีแก้ปัญหาที่สมบูรณ์แบบ ในกรณีของฉันมันทำงานได้ดีจนกระทั่งการเปลี่ยนแปลงครั้งล่าสุดของฉัน
157 android  cordova 

22
จะปิดแอปพลิเคชัน Android ได้อย่างไร
ฉันต้องการปิดแอปพลิเคชันของฉันเพื่อไม่ให้ทำงานในพื้นหลังอีกต่อไป ทำอย่างไร นี่เป็นแนวปฏิบัติที่ดีบนแพลตฟอร์ม Android หรือไม่ ถ้าฉันใช้ปุ่ม "ย้อนกลับ" มันจะปิดแอพ แต่จะอยู่ในพื้นหลัง มีแอปพลิเคชันที่เรียกว่า "TaskKiller" เพียงเพื่อฆ่าแอปเหล่านั้นในพื้นหลัง
157 android 


28
ListView ข้างใน ScrollView ไม่ได้เลื่อนบน Android
ฉันกำลังมีปัญหากับการเลื่อนภายในListView ScrollViewฉันมีกิจกรรมที่มี EditTexts บางส่วนในส่วนบนสุดแล้วโฮสต์แท็บที่มีสองแท็บที่มีหนึ่ง ListView แต่ละรายการ เมื่อเน้นมุมมอง EditText แป้นพิมพ์นุ่ม ๆ จะปรากฏขึ้นและเมื่อฉันมี ScrollView เนื้อหาจะสามารถเลื่อนได้ แต่ปัญหามาเมื่อมีรายการเพิ่มเติมใน ListViews (รายการในแท็บ) ฉันไม่สามารถเลื่อนมุมมอง ListView แม้ว่าจะมีรายการเพิ่มเติม ต่อไปนี้คือโครงร่าง XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="?backgroundImage" android:orientation="vertical"&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="50dip" android:layout_alignParentBottom="true" android:layout_margin="10dip" android:id="@+id/buttons"&gt; &lt;Button android:text="Save" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnSaveorUpdate" android:layout_height="wrap_content" android:layout_width="145dip"&gt;&lt;/Button&gt; &lt;Button android:text="Cancel" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnCancelorDelete" android:layout_height="wrap_content" …

14
ไม่พบ com.android.tools.build:gradle:3.0.0-alpha1 ในวงกลม ci
ฉันอัปเดตปลั๊กอิน gradle เป็นเวอร์ชันล่าสุด: com.android.tools.build:gradle:3.0.0-alpha1 และเกิดข้อผิดพลาดนี้: export TERM="dumb" if [ -e ./gradlew ]; then ./gradlew test;else gradle test;fi FAILURE: Build failed with an exception. What went wrong: A problem occurred configuring root project 'Android-app'. Could not resolve all dependencies for configuration ':classpath'. Could not find com.android.tools.build:gradle:3.0.0-alpha1. Searched in the following locations: …

3
ขอบในรูปร่าง xml
ฉันกำลังพยายามทำให้ drawable ใช้สำหรับปุ่ม ฉันต้องการให้สีนี้มีเส้นขอบ 2px รอบ ๆ ทุกอย่างใช้งานได้ดียกเว้นฉันไม่สามารถแสดงชายแดนได้ &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" &gt; &lt;gradient android:startColor="@color/bar_clicked_dark" android:endColor="@color/bar_clicked_light" android:angle="90"/&gt; &lt;corners android:bottomLeftRadius="0dp" android:topLeftRadius="15dp" android:bottomRightRadius="15dp" android:topRightRadius="0dp" /&gt; &lt;stroke android:width="2dp" color="#ff00ffff" /&gt; &lt;/shape&gt;

17
ไม่พบ api_key / คีย์ปัจจุบันด้วย Google Services 3.0.0
เนื่องจากฉันอัปเกรดโครงการด้วยบริการและไลบรารีของ Google รุ่นล่าสุด (9.0.0) ฉันมีปัญหาที่แปลกประหลาดนี้: คอนโซลเกรด: :app:processDebugGoogleServices Parsing json file: /Users/cyrilmorales/Documents/Projects/mobilemeans-punainenristi/app/google-services.json :app:processDebugGoogleServices FAILED Error:Execution failed for task ':app:processDebugGoogleServices'. &gt; Missing api_key/current_key object Information:BUILD FAILED build.gradle (root): dependencies { classpath 'com.android.tools.build:gradle:2.2.0-alpha1' classpath 'com.google.gms:google-services:3.0.0' } build.gradle (แอป): dependencies { .... compile 'com.google.android.gms:play-services-analytics:9.0.0' compile 'com.google.android.gms:play-services-gcm:9.0.0' compile 'com.google.android.gms:play-services-maps:9.0.0' compile 'com.google.android.gms:play-services-location:9.0.0' ... } apply plugin: …

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