0

Ich möchte eine "Assistentenleiste" einrichten, die die Schritte eines Setup-Prozesses wie folgt zeigt.Wie erstellt man eine "Multi-Setup-Assistentenleiste" in Android?

enter image description here

Also, wenn ich in der zweiten Stufe des Assistenten, dann 2 Tasten gefüllt usw. Jedoch Taste Füllung und alles, was ich kann manuell tun (was bedeutet, dass es nicht mit den Assistenten arbeiten muß Schritt automatisch), aber ich bin mir nicht sicher, wie man das implementiert.

Ich bin derzeit auf ViewPager. Irgendwelche Ideen?

mylayout.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"> 

</RelativeLayout> 

Antwort

0
public void updateIndicators(int position) { 
     DisplayMetrics metrics = getResources().getDisplayMetrics(); 
     int resizeValue = (int) TypedValue.applyDimension(
      TypedValue.COMPLEX_UNIT_DIP, 25, metrics); 
     int defaultValue = (int) TypedValue.applyDimension(
      TypedValue.COMPLEX_UNIT_DIP, 15, metrics); 
     switch (position) { 
     case 0: 
      indicator1.getLayoutParams().height = resizeValue; 
      indicator1.getLayoutParams().width = resizeValue; 
      indicator1.requestLayout(); 

      indicator2.getLayoutParams().height = defaultValue; 
      indicator2.getLayoutParams().width = defaultValue; 
      indicator2.requestLayout(); 

      indicator3.getLayoutParams().height = defaultValue; 
      indicator3.getLayoutParams().width = defaultValue; 
      indicator3.requestLayout(); 

      indicator4.getLayoutParams().height = defaultValue; 
      indicator4.getLayoutParams().width = defaultValue; 
      indicator4.requestLayout(); 

      break; 

     case 1: 
      indicator1.getLayoutParams().height = defaultValue; 
      indicator1.getLayoutParams().width = defaultValue; 
      indicator1.requestLayout(); 

      indicator2.getLayoutParams().height = resizeValue; 
      indicator2.getLayoutParams().width = resizeValue; 
      indicator2.requestLayout(); 

      indicator3.getLayoutParams().height = defaultValue; 
      indicator3.getLayoutParams().width = defaultValue; 
      indicator3.requestLayout(); 

      indicator4.getLayoutParams().height = defaultValue; 
      indicator4.getLayoutParams().width = defaultValue; 
      indicator4.requestLayout(); 
      break; 

     case 2: 
      indicator1.getLayoutParams().height = defaultValue; 
      indicator1.getLayoutParams().width = defaultValue; 
      indicator1.requestLayout(); 

      indicator2.getLayoutParams().height = defaultValue; 
      indicator2.getLayoutParams().width = defaultValue; 
      indicator2.requestLayout(); 

      indicator3.getLayoutParams().height = resizeValue; 
      indicator3.getLayoutParams().width = resizeValue; 
      indicator3.requestLayout(); 

      indicator4.getLayoutParams().height = defaultValue; 
      indicator4.getLayoutParams().width = defaultValue; 
      indicator4.requestLayout(); 
      break; 

     case 3: 
      indicator1.getLayoutParams().height = defaultValue; 
      indicator1.getLayoutParams().width = defaultValue; 
      indicator1.requestLayout(); 

      indicator2.getLayoutParams().height = defaultValue; 
      indicator2.getLayoutParams().width = defaultValue; 
      indicator2.requestLayout(); 

      indicator3.getLayoutParams().height = defaultValue; 
      indicator3.getLayoutParams().width = defaultValue; 
      indicator3.requestLayout(); 

      indicator4.getLayoutParams().height = resizeValue; 
      indicator4.getLayoutParams().width = resizeValue; 
      indicator4.requestLayout(); 
      break; 
     } 

    } 
0
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.androidsrc.viewpagerindicator.MainActivity" > 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewPager" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

    <LinearLayout 
     android:layout_margin="10dp" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:layout_gravity="bottom" 
     android:orientation="horizontal" > 

     <View 
      android:id="@+id/indicator1" 
      android:layout_width="15dp" 
      android:layout_height="15dp" 
      android:layout_margin="2dp" 
      android:background="@drawable/indicator_bg" /> 

     <View 
      android:id="@+id/indicator2" 
      android:layout_width="15dp" 
      android:layout_height="15dp" 
      android:layout_margin="2dp" 
      android:background="@drawable/indicator_bg" /> 

     <View 
      android:id="@+id/indicator3" 
      android:layout_width="15dp" 
      android:layout_height="15dp" 
      android:layout_margin="2dp" 
      android:background="@drawable/indicator_bg" /> 

     <View 
      android:id="@+id/indicator4" 
      android:layout_width="15dp" 
      android:layout_height="15dp" 
      android:layout_margin="2dp" 
      android:background="@drawable/indicator_bg" /> 
    </LinearLayout> 

</FrameLayout> 


Make indicator view in xml like this. 
Verwandte Themen