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

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

17
ไม่พบทรัพยากร - Theme.AppCompat.Light.DarkActionBar
ฉันใช้ ActionBar Style Generator และตอนนี้พยายามใช้กับแอพของฉัน แต่ได้รับ: ข้อผิดพลาด: เกิดข้อผิดพลาดในการดึงข้อมูลพาเรนต์สำหรับรายการ: ไม่พบทรัพยากรที่ตรงกับชื่อที่ระบุ '@ style / Theme.AppCompat.Light.DarkActionBar' ฉันใช้android-support-v7-appcompat.jar lib ภายในโฟลเดอร์ libs เป้าหมายของฉันคือทำให้แอปของฉันใช้ร่วมกันได้ 2.3 ขึ้นไป

4
เหตุการณ์สำหรับการจัดการโฟกัสของ EditText
ใครสามารถแนะนำฉันเหตุการณ์ใด ๆ ที่เกี่ยวข้องกับการมุ่งเน้นของEditText? แอปพลิเคชันของฉันมี a EditTextซึ่งยอมรับ URL อยู่ ตอนนี้ปัญหาของฉันคือว่าหลังจากที่ผู้ใช้จะป้อน URL ในฟิลด์และย้ายเพิ่มเติมโดยไม่ต้องคลิกเหตุการณ์ใด ๆ เช่นเมื่อโฟกัสจะย้ายจากEditTextมันควรตรวจจับ URL ที่ป้อนและไปที่เซิร์ฟเวอร์ ถ้าฉันได้รับคำตอบโดยใช้ Json Parsing มันจะสะดวกกว่า

9
ตรวจสอบขนาดฮีปของแอปพลิเคชันใน Android
คุณจะตรวจสอบขนาดแอพพลิเคชั่นฮีปที่พร้อมใช้งานสำหรับแอพ Android โดยทางโปรแกรมได้อย่างไร ฉันได้ยินมาว่ามีฟังก์ชั่นที่ทำสิ่งนี้ใน SDK รุ่นที่ใหม่กว่า ไม่ว่าในกรณีใดฉันกำลังมองหาโซลูชันที่ใช้งานได้ตั้งแต่ 1.5 ขึ้นไป

7
เปลี่ยนสีแถบสถานะด้วย AppCompat ActionBarActivity
Paletteหนึ่งในกิจกรรมของฉันฉันเปลี่ยนสีโดยใช้แถบเครื่องมือ แต่ใน 5.0 อุปกรณ์ที่ใช้สีเป็นสีของฉันในชุดรูปแบบกิจกรรมของฉันเพื่อให้ฉันมี 2 สีที่แตกต่างกันมากและมันก็ไม่ได้ดูดีActionBarActivitystatus barcolorPrimaryDark ฉันรู้ว่าใน 5.0 คุณสามารถใช้Window.setStatusBarColor()แต่ActionBarActivityไม่มีสิ่งนี้ ดังนั้นคำถามของฉันคือ 5.0 ฉันจะเปลี่ยนสีของแถบสถานะได้ActionBarActivityอย่างไร

11
RecyclerView ขยาย / ยุบรายการ
ฉันต้องการขยาย / ยุบรายการ recyclerView ของฉันเพื่อแสดงข้อมูลเพิ่มเติม ฉันต้องการที่จะบรรลุผลเช่นเดียวกันของSlideExpandableListView โดยทั่วไปในมุมมองของฉันโฟลเดอร์ฉันมีมุมมองที่มองไม่เห็นและฉันต้องการที่จะทำภาพเคลื่อนไหวขยาย / ยุบอย่างราบรื่นมากกว่าตั้งค่าการมองเห็นเป็น VISIBLE / GONE เท่านั้น ฉันต้องการเพียงแค่รายการที่จะขยายในเวลาและมันจะเจ๋งที่จะมีระดับความสูงเพื่อแสดงว่ารายการที่เลือก มันเป็นผลเช่นเดียวกันของรายการประวัติการโทรล่าสุดของ Android ตัวเลือก "การโทรกลับ" และ "รายละเอียด" จะปรากฏให้เห็นเฉพาะเมื่อมีการเลือกรายการ

7
ViewPager ที่มีขอบเขตหน้าก่อนหน้าและถัดไป
ฉันกำลังออกแบบมุมมองที่มีหลายหน้า ฉันต้องการให้ขอบของหน้าก่อนหน้าและหน้าถัดไปแสดงแบบด้านล่างและใช้การปัดสองนิ้วเพื่อสลับระหว่างหน้า ฉันลองใช้โดยViewPagerมีขอบหน้าติดลบตามที่แนะนำที่นี่แต่แสดงให้เห็นเพียงหนึ่งในขอบบนหน้าจอไม่ใช่ทั้งสองอย่างพร้อมกัน อีกวิธีหนึ่งคือมีวิธีใดที่ฉันสามารถวางตำแหน่งส่วนหนึ่งของมุมมองของฉันนอกหน้าจอแล้วเคลื่อนไหวมันให้ViewPagerผลชนิด ฉันจะไปเกี่ยวกับมันได้อย่างไร ขอบคุณมาก!

4
Android: วิธีการตั้งค่าขนาดของเค้าโครงโดยทางโปรแกรม
ในฐานะที่เป็นส่วนหนึ่งของแอพ Android ฉันกำลังสร้างชุดปุ่ม ปุ่มเป็นส่วนหนึ่งของชุด LinearLayouts ซ้อนกัน การใช้น้ำหนักฉันมีชุดการปรับขนาดตัวเองโดยอัตโนมัติตามขนาดของ LinearLayout หลักที่มี แนวคิดนี้ขึ้นอยู่กับจำนวนพิกเซลและความหนาแน่นของหน้าจอเพื่อกำหนดขนาดของเค้าโครงที่มีจำนวนพิกเซล; และตั้งค่าปุ่มให้ปรับขนาดตัวเองตามการเปลี่ยนแปลงนั้น คำถามคือ: วิธีการปรับขนาดเค้าโครง ฉันได้ลองใช้เทคนิคที่แนะนำหลายอย่างแล้วและไม่มีใครเข้ามาทำงานได้ นี่เป็นส่วนย่อยของ XML ที่สร้างชุดปุ่ม: <LinearLayout android:layout_height="104pt" android:id="@+id/numberPadLayout" android:orientation="horizontal" android:layout_width="104pt" android:background="#a0a0a0" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" > <LinearLayout android:layout_weight="2" android:layout_height="fill_parent" android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_width="wrap_content"> <Button android:text="1" android:id="@+id/button1" android:layout_weight="2" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> <Button android:text="4" android:id="@+id/button4" android:layout_weight="2" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> <Button android:text="7" android:id="@+id/button7" android:layout_weight="2" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> …

7
android.content.res.Resources $ NotFoundException: ID ทรัพยากรสตริง # 0x0
ฉันกำลังพัฒนาแอพ Android ที่อ่านข้อมูลจากฐานข้อมูล MySQL และฉันพบข้อผิดพลาดนี้ ฉันมีเค้าโครง XML นี้: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/wardNumber" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:text="Ward Number" android:textSize="22dp"/> <TextView android:id="@+id/dateTime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/wardNumber" android:layout_alignParentRight="true" android:layout_marginRight="3dp" android:text="Date-Time" /> <TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/dateTime" android:layout_alignBottom="@+id/dateTime" android:layout_alignLeft="@+id/wardNumber" android:layout_marginLeft="3dp" android:text="Name" /> </RelativeLayout> และนี่คือไฟล์ Java ของฉัน: public ApplicationAdapter(Context …
145 java  android  xml  listview 

8
วิธีสร้าง buildConfigField ด้วยชนิดสตริง
ในAndroid Studioโครงการของฉันมีสองbuild configurationอย่างbuildConfigFieldคือ: buildTypes { def SERVER_URL = "SERVER_URL" def APP_VERSION = "APP_VERSION" debug { buildConfigField "String", SERVER_URL, "http://dev.myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" } release { buildConfigField "String", SERVER_URL, "https://myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } ฉันได้รับและข้อผิดพลาดดังต่อไปนี้: /path/to/generated/BuildConfig.java Error:(14, 47) error: ';' expected Error:(15, 47) …

10
match_parent width ไม่ทำงานใน RecyclerView
RecyclerView และรายการของฉันมีความกว้างที่ตรงกัน แต่ผลลัพธ์คือ: <view class="android.support.v7.widget.RecyclerView" android:layout_width="match_parent" และรายการ: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:id="@+id/ll_itm" android:orientation="horizontal" android:layout_width="match_parent" เต็ม: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:id="@+id/ll_itm" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="100" android:gravity="right" > <Button android:layout_width="0dp" android:layout_weight="15" android:layout_height="fill_parent" android:text="ملاحظات" android:id="@+id/button" /> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="20" android:gravity="center" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="fill_parent" android:layout_height="fill_parent" …

7
java.net.SocketException: ซ็อกเก็ตล้มเหลว: EPERM (ไม่อนุญาตให้ดำเนินการ)
ฉันกำลังทำโปรเจ็กต์ Android Studio ที่มีกิจกรรมมากมาย ขณะนี้ฉันพยายามอ่านผลลัพธ์จาก Java Servlet บน localhost แต่ดูเหมือนว่าจะหยุดทำงานเนื่องจากได้รับอนุญาตจากซ็อกเก็ต ฉันได้สร้างโปรเจ็กต์ใหม่โดยใช้รหัสเดียวกันและทำงานได้อย่างสมบูรณ์ ดังนั้นฉันไม่เข้าใจว่าทำไมไม่เต็มใจที่จะทำงานในโครงการของฉัน public class LoginActivity extends AppCompatActivity { String apiUrl = "http://10.0.2.2:8080/ProyectService/Servlet?action=login"; EditText username; EditText password; AlertDialog dialog; Usuario session; @Override public void onCreate(Bundle savedInstanceState) { // Inicializacion de ventana super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); getSupportActionBar().hide(); // Inicializacion de componentes username = findViewById(R.id.username); …
145 java  android  json  servlets 

20
เปิดตัวแอปพลิเคชัน SMS ด้วยเจตนา
ฉันมีคำถามเกี่ยวกับเจตนา ... ฉันพยายามเปิดแอพ sms ... Intent intent = new Intent(Intent.ACTION_MAIN); intent.setType("vnd.android-dir/mms-sms"); int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP; intent.setFlags(flags); intent.setData(Uri.parse("content://sms/inbox")); context.startActivity(intent); ดังนั้นคุณจะเห็นว่าฉันตั้งใจทำสิ่งต่าง ๆ มากเกินไป แต่นั่นเป็นเพราะฉันไม่รู้ว่าฉันจะทำได้อย่างไร ... ขอบคุณ

2
มุมมองภายใน ScrollView ไม่เกิดขึ้น
ฉันมี RelativeLayout ภายใน ScrollView My RelativeLayout มีandroid:layout_height="match_parent"แต่มุมมองไม่ได้ใช้ขนาดทั้งหมดมันเหมือนกับ wrap_content มีวิธีที่จะมีพฤติกรรม fill_parent / match_parent จริงหรือไม่? เลย์เอาต์ของฉัน: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/top" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:scaleType="fitXY" android:src="@drawable/top" /> <ImageView android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/top" android:scaleType="fitXY" android:src="@drawable/headerbig" /> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/header" android:layout_centerHorizontal="true" android:layout_marginBottom="3dp" android:src="@drawable/logo" /> <ScrollView android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_above="@+id/bottom" android:layout_below="@+id/logo" android:background="@drawable/background" > …

13
Android - startActivityForResult จะเรียกใช้งาน ActivityResult ทันที
ฉันกำลังเปิดตัวกิจกรรมจากกิจกรรมหลักในแอปของฉันโดยใช้การโทรstartActivityForResult(intent, ACTIVITY_TYPE)และพวกเขาทั้งหมดทำงานได้ แต่หนึ่ง กิจกรรมนี้เรียกว่าเปิดตัวกิจกรรมตามที่ต้องการ แต่ในบันทึกฉันเห็นว่าonActivityResult()มันถูกทริกเกอร์ทันที กิจกรรมการแสดง แต่ถูกส่งกลับทันที RESULT_CANCELEDonActivityResult() จากนั้นฉันโต้ตอบกับกิจกรรมกดปุ่มที่โทรfinish()และonActivityResult()ไม่ได้เรียกในเวลานี้ (เพราะเห็นได้ชัดว่ามีการส่งคืนผลลัพธ์แล้ว) มันสมเหตุสมผลกับทุกคนไหม? มีใครเคยเห็นพฤติกรรมนี้มาก่อนหรือไม่

25
ข้อผิดพลาด: ไม่พบตัวระบุทรัพยากรสำหรับแอตทริบิวต์ 'adSize' ในแพ็คเกจ 'com.google.example' main.xml
เมื่อฉันทำตามคำแนะนำเพื่อเพิ่มโฆษณาลงในแอพโดย xml ฉันพบข้อผิดพลาดดังต่อไปนี้: Description Resource Path Location Type error: No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml /HelloWorld/res/layout line 12 Android AAPT Problem Description Resource Path Location Type error: No resource identifier found for attribute 'adUnitId' in package 'com.google.example' main.xml /HelloWorld/res/layout line 12 Android AAPT Problem ฉันแก้ไขmain.xml, …
144 android  admob 

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