2017-01-24 23 views
0

私はアンドロイドアプリを作成していますが、いくつかのボタンが含まれていますが、エミュレータと古いアンドロイドバージョン(4.1.2,4.4.2,4.4.4) 6.0バージョン。私の分のSDKのバージョンが14であるとtargetsdkは25このボタンでactivity_main.xmlボタンはエミュレータでは動作しますが、デバイス上では動作しません

であるこれは私のボタンです:

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_main" 
    android:layout_width="match_parent" 
    tools:context="com.example.besart.learngerman.MainActivity" 
    tools:showIn="@layout/activity_main" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_height="5000dp" 
     android:paddingLeft="5dp" 
     android:paddingRight="5dp" 
     android:layout_width="match_parent" 
     android:orientation="vertical"> 

     <Button 
      android:text="Alfabeti, ditet, numrat,..." 
      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:id="@+id/button" 
      android:background="#551905" 
      android:textColor="#fff" 
      android:layout_marginTop="5dp" 
      android:onClick="alfabetiDheNumratClick" /> 

    </LinearLayout> 
</ScrollView> 

、これはAndroidManifest.xmlを

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.besart.learngerman"> 

    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25" /> 

    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:supportsRtl="false" 
     android:label="@string/app_name" 

    </application> 

です

オンクライク方式:

public void alfabetiDheNumratClick(View view){ 
    clickbutton.start(); 
    Intent i = new Intent(this, AlfabetiDheNumratActivity.class); 
    startActivity(i); 
} 
+0

「うまくいかない」とは何ですか?そしてなぜマニフェストファイルを投稿していますか? – greenapps

+0

このボタンは、実際のデバイスでテストすると、エミュレータといくつかの古いアンドロイドバージョン(4.2.1,4.2.2)では動作しますが、バージョン6.0では動作しません。 – Besart

+0

「うまくいかない」とはどういう意味ですか?私はそれ以前に尋ねた。 – greenapps

答えて

1

を解決することを確認してみてください。 あなたの活動をマニフェストに登録

<application> 
<activity android:name"your_activity_name"/> 
</application> 
0

Intent i = new Intent(Your_activity_name.this, AlfabetiDheNumratActivity.class); 
    startActivity(i); 

OR

<Button 
      android:text="Alfabeti, ditet, numrat,..." 
      android:layout_width="match_parent" 
      android:layout_height="50dp" 
      android:id="@+id/button" 
      android:clickable="true" 
      android:background="#551905" 
      android:textColor="#fff" 
      android:layout_marginTop="5dp" 
      android:onClick="alfabetiDheNumratClick" /> 

しかしi'amないあなたは、あなたのマニフェストファイルに登録されているすべての活動を持っていない、それはあなたの問題

関連する問題