Bladeren bron

fixbug:测试页面的UI修改

Sora 1 jaar geleden
bovenliggende
commit
f1839edc5d

+ 24 - 0
app/src/main/java/com/sheep/gamegroup/module/search/ActSearch.java

@@ -1,11 +1,16 @@
 package com.sheep.gamegroup.module.search;
 
+import android.content.Context;
+import android.graphics.Color;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
 import android.widget.TextView;
 
+import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
 import androidx.fragment.app.Fragment;
 
 import com.kfzs.android.view.tag.FlowLayout;
@@ -148,6 +153,14 @@ public class ActSearch extends BaseContainerActivity {
                 .setTitleBackgroud(this, R.color.white_light)
                 .setRightBtn(this, "搜索", 0,
                         v -> toSearchApp());
+        AppCompatAutoCompleteTextView box = findViewById(R.id.box_baseactivity_search);
+        Button right = findViewById(R.id.btn_baseactivity_right);
+        right.setTextColor(Color.parseColor("#ff2ebef2"));
+        box.setFocusable(true);
+        box.setFocusableInTouchMode(true);
+        box.requestFocus();
+        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+        imm.showSoftInput(box, InputMethodManager.SHOW_IMPLICIT);
     }
 
     @Override
@@ -156,6 +169,17 @@ public class ActSearch extends BaseContainerActivity {
         onRefresh();
     }
 
+    @Override
+    public void onWindowFocusChanged(boolean hasFocus) {
+        super.onWindowFocusChanged(hasFocus);
+        if (hasFocus) {
+            AppCompatAutoCompleteTextView box = findViewById(R.id.box_baseactivity_search);
+            box.requestFocus();
+            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
+        }
+    }
+
     private void showKeywords() {
         if (hintKeyword != null) {
             TitleBarUtils.getInstance().setSearchHint(ActSearch.this, hintKeyword.getKeyword());

+ 2 - 0
app/src/main/res/layout/title.xml

@@ -88,6 +88,7 @@
             android:lines="1"
             android:paddingStart="17dp"
             android:paddingEnd="17dp"
+            tools:text="文字按钮"
             android:textColor="@color/black_text_deep"
             android:textSize="12sp"
             tools:ignore="UnusedAttribute" />
@@ -144,6 +145,7 @@
         android:text="发表"
         android:textColor="#ff2ebef2"
         android:textSize="14sp"
+        tools:visibility="visible"
         android:visibility="gone"
         tools:ignore="UnusedAttribute" />