Open adsau59 opened 7 years ago
it works in ur demo but doesnt work in my try demo.... can u explain y?
activity_main.xml `<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="in.definex.myapplication.MainActivity">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" android:id="@+id/textview"/>
`
MainActivity.java `package in.definex.myapplication;
import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast;
import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ActionViewTarget; import com.github.amlcurran.showcaseview.targets.ViewTarget;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ShowcaseView sv; ViewTarget target = new ViewTarget(R.id.textview, this); sv = new ShowcaseView.Builder(this) .withMaterialShowcase() .setTarget(target) .setContentTitle("yo") .setContentText("yoooooooo") .build(); sv.overrideButtonClick(new View.OnClickListener() { @Override public void onClick(View view) { sv.hide(); } }); final Context c = this; Button b = (Button) findViewById(R.id.textview); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(c,"Yo", Toast.LENGTH_LONG).show(); } }); }
}`
build.gradle `apply plugin: 'com.android.application'
android { compileSdkVersion 25 buildToolsVersion "25.0.1" defaultConfig { applicationId "in.definex.myapplication" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.0.1' testCompile 'junit:junit:4.12'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
it works in ur demo but doesnt work in my try demo.... can u explain y?
activity_main.xml `<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="in.definex.myapplication.MainActivity">
`
MainActivity.java `package in.definex.myapplication;
import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast;
import com.github.amlcurran.showcaseview.ShowcaseView; import com.github.amlcurran.showcaseview.targets.ActionViewTarget; import com.github.amlcurran.showcaseview.targets.ViewTarget;
public class MainActivity extends AppCompatActivity {
}`
build.gradle `apply plugin: 'com.android.application'
android { compileSdkVersion 25 buildToolsVersion "25.0.1" defaultConfig { applicationId "in.definex.myapplication" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.0.1' testCompile 'junit:junit:4.12'
}`