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

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



8
ปรับภาพใน ImageButton ใน Android
ฉันมี ImageButton 6 ตัวในกิจกรรมของฉันฉันตั้งค่ารูปภาพผ่านรหัสของฉัน (ไม่ได้ใช้ xml) ฉันต้องการให้พวกเขาครอบคลุม 75% ของพื้นที่ปุ่ม แต่เมื่อภาพบางภาพครอบคลุมพื้นที่น้อยลงบางภาพก็ใหญ่เกินไปที่จะใส่ลงในปุ่มรูปถ่ายได้ วิธีการปรับขนาดแบบเป็นโปรแกรมและแสดงพวกเขา? ด้านล่างเป็นภาพหน้าจอ ด้านล่างคือไฟล์ xml <?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" android:layout_marginBottom="5sp" android:layout_marginLeft="2sp" android:layout_marginRight="5sp" android:layout_marginTop="0sp" > <LinearLayout android:layout_height="0dp" android:layout_width="match_parent" android:layout_weight="1" android:orientation="horizontal"> <ImageButton android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_topleft" android:layout_marginBottom="5sp" android:layout_marginLeft="2sp" android:layout_marginRight="5sp" android:layout_marginTop="0sp" /> <ImageButton android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_topright" android:layout_marginBottom="5sp" android:layout_marginLeft="2sp" android:layout_marginRight="5sp" …

14
เครื่องมือ: แทนที่ไม่แทนที่ในรายการ Android
ฉันกำลังใช้โครงการ gradle ที่มีการขึ้นต่อกันหลายไลบรารีและใช้การรวมรายการใหม่ ใน<application />แท็กของฉันฉันได้ตั้งค่าเช่น: <application tools:replace="android:icon, android:label, android:theme, android:name" android:name="com.example.myapp.MyApplcation" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/application_name" android:logo="@drawable/logo_ab" android:theme="@style/AppTheme" > .... </application> แต่ฉันได้รับข้อผิดพลาด: /android/MyApp/app/src/main/AndroidManifest.xml:29:9 Error: Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:29:9 is also present at {Library Name} value=(@drawable/app_icon) Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:26:5 to override /android/MyApp/app/src/main/AndroidManifest.xml:30:9 Error: Attribute application@label value=(@string/application_name) from …


5
คำสั่งการจัดรูปแบบในไฟล์ทรัพยากรสตริง
ฉันมีสตริงที่กำหนดไว้ในไฟล์ resources.xml ปกติเช่นนี้ <string name="hello_world"> HELLO</string> มันเป็นไปได้ที่จะกำหนดสตริงรูปแบบเช่นหนึ่งด้านล่าง result_str = String.format("Amount: %.2f for %d days ", var1, var2); ในไฟล์ทรัพยากร strings.xml? ฉันพยายามหลบหนีอักขระพิเศษ แต่มันไม่ทำงาน

15
จะแสดงช่องทำเครื่องหมาย android ทางด้านขวาได้อย่างไร
โดยค่าเริ่มต้นหุ่นยนต์ช่องทำเครื่องหมายแสดงข้อความทางด้านขวาและช่องทำเครื่องหมายที่ด้านซ้าย ฉันต้องการที่จะแสดงช่องทำเครื่องหมายที่ด้านขวาด้วยข้อความทางด้านซ้าย ฉันจะทำสิ่งนี้ได้อย่างไร
146 android  layout  checkbox 

18
ลบไอคอน / โลโก้จากแถบการกระทำบน Android
ฉันพยายามหาวิธีลบไอคอน / โลโก้ออกจากแถบแอ็คชัน แต่สิ่งเดียวที่ฉันพบหลังจากใช้เวลาค้นหาไฟล์เอกสารของ Android และ Google เป็นเวลาหนึ่งชั่วโมงคือวิธีลบแถบชื่อออกทั้งหมด นั่นไม่ใช่สิ่งที่ฉันต้องการ ต้องการลบไอคอน / โลโก้ออกจากแถบหัวเรื่องเท่านั้น มีใครรู้วิธีการทำเช่นนี้? โดยเฉพาะอย่างยิ่งผมอยากจะทำเช่นนี้ในXML


9
ไอคอนจำนวนการแจ้งเตือนของ Actionbar (ตราสัญลักษณ์) เช่นเดียวกับ Google
มีสัญลักษณ์หรือวิธีมาตรฐาน Android เพื่อแสดงไอคอนการแจ้งเตือนของแถบการกระทำที่มีจำนวนเหมือนในตัวอย่างของ Google หรือไม่? ถ้าไม่เช่นนั้นวิธีที่ดีที่สุดที่จะทำคืออะไร? ฉันใหม่สำหรับ Android โปรดช่วยด้วย

6
การจัดเก็บ R.drawable IDs ในอาร์เรย์ XML
ฉันต้องการเก็บ ID ของทรัพยากร drawable ในรูปแบบของR.drawable.*อาร์เรย์ภายในโดยใช้ไฟล์ค่า XML แล้วดึงข้อมูลอาร์เรย์ในกิจกรรมของฉัน ความคิดใด ๆ ของวิธีการบรรลุสิ่งนี้?

3
กลไกการรีไซเคิล ListView ทำงานอย่างไร
ดังนั้นผมจึงมีปัญหานี้ผมมีมาก่อนและเป็นธรรมชาติที่ฉันขอความช่วยเหลือได้ที่นี่ คำตอบของ Luksprog นั้นยอดเยี่ยมเพราะฉันไม่รู้ว่า ListView และ GridView ปรับตัวเองอย่างไรด้วยการรีไซเคิล Views ดังนั้นด้วยคำแนะนำของเขาฉันสามารถเปลี่ยนวิธีที่ฉันเพิ่ม Views ให้กับ GridView ของฉัน ปัญหาคือตอนนี้ฉันมีสิ่งที่ไม่สมเหตุสมผล นี่คือของฉันgetViewจากของฉันBaseAdapter: public View getView(int position, View convertView, ViewGroup parent) { if(convertView == null) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); convertView = inflater.inflate(R.layout.day_view_item, parent, false); } Log.d("DayViewActivity", "Position is: "+position); ((TextView)convertView.findViewById(R.id.day_hour_side)).setText(array[position]); LinearLayout layout = (LinearLayout)convertView.findViewById(R.id.day_event_layout); //layout.addView(new EventFrame(parent.getContext())); …

6
เลือกไฟล์โต้ตอบ [ปิด]
ปิด. คำถามนี้ไม่เป็นไปตามหลักเกณฑ์กองมากเกิน ไม่ยอมรับคำตอบในขณะนี้ ต้องการปรับปรุงคำถามนี้หรือไม่ อัปเดตคำถามเพื่อให้เป็นไปตามหัวข้อสำหรับ Stack Overflow ปิดให้บริการใน6 ปีที่ผ่านมา ปรับปรุงคำถามนี้ ไม่มีใครรู้ว่าโต้ตอบเลือกไฟล์ที่สมบูรณ์? อาจเป็นไฟล์ที่คุณสามารถกรองไฟล์ทั้งหมดยกเว้นไฟล์ที่มีนามสกุลเฉพาะได้หรือไม่ ฉันไม่พบสิ่งที่มีน้ำหนักเบาพอที่จะนำไปใช้กับโครงการของฉันได้อย่างง่ายดาย ตัวเลือกอื่น ๆ เท่านั้นที่ดูเหมือนว่ากำลังใช้ Intents แบบเปิดของ OI FileManager แต่ต้องการผู้ใช้ที่ติดตั้งตัวจัดการไฟล์ไว้แล้ว ฉันจะขอบคุณถ้ามีคนสามารถชี้ไดอะล็อกที่อนุญาตให้ผู้ใช้เรียกดูโฟลเดอร์และเลือกไฟล์และส่งคืนพา ธ

10
ฝังโฆษณาลงในแอพ Android หรือไม่
ฉันต้องการสร้างแอป Android เวอร์ชันฟรีที่ฉันมี แต่ต้องการฝังโฆษณาบนมัน ฉันไม่แน่ใจว่าควรเริ่มจากตรงไหน? มี บริษัท โฆษณาบนมือถือที่รู้จักกันดีว่ามีความเชี่ยวชาญในการโฆษณาบนมือถือหรือไม่?

26
เปลี่ยนสีคำใบ้ EditText เมื่อใช้ TextInputLayout
ฉันกำลังใช้สิ่งใหม่ TextInputLayoutจากไลบรารีการออกแบบ ฉันสามารถทำให้มันแสดงและเปลี่ยนสีของฉลากลอยได้ น่าเสียดายที่EditTextคำใบ้จริงตอนนี้เป็นสีขาวเสมอ ฉันได้ลองเปลี่ยน hintColor ใน XML สไตล์และการเขียนโปรแกรมแล้วและลองใช้android.support.v7.widget.AppCompatEditText แต่EditTextคำใบ้แสดงสีขาวอยู่เสมอ นี่คือ XML ของฉันสำหรับฉันTextInputLayoutและEditText <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android.support.design:hintTextAppearance="@style/GreenTextInputLayout"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/city" android:textColorHint="@color/black" android:hint="@string/city" /> </android.support.design.widget.TextInputLayout> และนี่คือสไตล์ที่ฉันใช้สำหรับTextInputLayout(ฉันพยายามทำให้hintTextColorคุณสมบัติเป็นสีดำ แต่ไม่ได้ทำอะไรให้ฉัน): <style name="GreenTextInputLayout" parent="@style/TextAppearance.AppCompat"> <item name="android:textColor">@color/homestory_green</item> </style>

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