Fonctionnalités cachées pour les développeurs de logiciels. Puisqu'il s'agit d'une fonction réservée aux développeurs, il est normal que les utilisateurs généraux ne puissent pas l'utiliser.
Ce n'est pas un must. C'est juste pour faciliter le débogage, alors commençons par entendre la personne qui effectue le débogage. Cependant, s'il y a une voix disant que ce serait bien de l'avoir, ou s'il faut un effort d'ingénieur pour le déboguer, il vaut mieux le faire.
Ceci est un échantillon de cellule d'article. Je pense que c'est normal pour les parents de l'enfermer dans ScrollView et de le multiplier.
activity_debug_menu.xml
<!--réduction-->
                <!--Affichage du nom du parent de l'élément&copie-->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/listview_height"
                android:background="@color/debug_item_parent_color"
                android:orientation="horizontal">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginLeft="@dimen/listview_margin_left"
                    android:gravity="left"
                    android:text="afficher&copie"
                    android:textColor="@color/debug_text_color"
                    android:textSize="14sp"/>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@android:color/white"
                android:orientation="vertical">
                <!-- Item Child Name Build Ver. -->
                <LinearLayout
                    android:id="@+id/build_info_area"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/listview_height"
                    android:layout_gravity="center"
                    android:background="@drawable/default_selector"
                    android:clickable="true"
                    android:orientation="horizontal"
                    android:paddingLeft="@dimen/listview_margin_left">
                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent">
                        <ImageView
                            android:layout_width="@dimen/listview_icon_width"
                            android:layout_height="@dimen/listview_icon_height"
                            android:layout_gravity="center"
                            android:layout_marginRight="@dimen/listview_icon_margin_right"
                            android:background="@drawable/ic_build_36dp"/>
                    </LinearLayout>
                    <LinearLayout
                        android:layout_width="125dp"
                        android:layout_height="match_parent">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_gravity="center"
                            android:layout_marginRight="10dp"
                            android:gravity="center"
                            android:text="BUILD Ver."
                            android:textSize="@dimen/listview_item_text_size"/>
                    </LinearLayout>
                <!--Acquisition Ver-->
                    <TextView
                        android:id="@+id/build_info_txt"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="left|center"
                        android:text="Ver.X.XX.X"
                        android:textColor="@color/debug_text_color"
                        android:textSize="@dimen/listview_item_text_size"/>
                </LinearLayout>
                <!--Séparateur-->
                <include layout="@layout/component_divider_wrap"/>
<!--réduction-->
C'est juste une ligne de démarcation.
component_divider_wrap.xml
<merge xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
    <LinearLayout
        android:id="@+id/div"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="72dp"
        android:layout_weight="1">
        <View style="@style/divider_horizontal"/>
    </LinearLayout>
</merge>
Un exemple est décrit dans onCreate comme exemple, mais il devient difficile à lire à mesure que le nombre d'éléments augmente, il peut donc être bon de lier des éléments avec Butter Knife.
DebugMenuActivity.java
public class DebugMenuActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_debug_menu);
        
        // Build Ver. Text
        TextView buildInfoTxt = (TextView)findViewById(R.id.build_info_txt);
        
        buildInfoTxt.setText("Ver. " + BuildConfig.VERSION_NAME + " " + BuildConfig.BUILD_TIMESTAMP + " " + BuildConfig.BUILD_HASH + " (" + BuildConfig.BUILD_MACHINE + ")");
        // Build Ver. Area
    LinearLayout buildInfoArea =(LinearLayout)findViewById(R.id.build_info_area);
        
        buildInfoArea.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                copyClipBoard((String)buildInfoTxt.getText());
            }
        });
    }
   //Copier dans le clip
   private void copyClipBoard(String copySource) {
        if (copySource.equals("")) {
            return;
        }
 
        //Créer un élément à stocker dans le presse-papiers
        ClipData.Item item = new ClipData.Item(copySource);
        //Créer un TYPE MIME
        String[] mimeType = new String[1];
        mimeType[0] = ClipDescription.MIMETYPE_TEXT_URILIST;
        //Création d'un objet ClipData à stocker dans le presse-papiers
        ClipData cd = new ClipData(new ClipDescription("text_data", mimeType), item);
        //Stocker les données dans le presse-papiers
        ClipboardManager cm = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
        cm.setPrimaryClip(cd);
    }
}
Si vous ajoutez une fonction qui donne une suggestion lorsque vous appuyez sur l'icône lorsque vous changez le nom d'hôte avec satisfaction, elle est étonnamment populaire, ou si vous l'implémentez car il est préférable de pouvoir authentifier l'accès externe, Pl me ** donnera de la viande grillée Était ** ** Athlètes ingénieurs qui aiment la viande grillée! Faisons-le: lunettes de soleil: **
Le 23 décembre est au tour de @ yuzu_afro!
Recommended Posts