Browse Source

spinner

master
NXX 1 year ago
parent
commit
9fcb13f498
9 changed files with 41 additions and 19 deletions
  1. +2
    -1
      app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java
  2. +1
    -1
      app/src/main/res/drawable/settingbutton.xml
  3. +2
    -2
      app/src/main/res/drawable/spinner_background.xml
  4. +3
    -3
      app/src/main/res/drawable/spinner_border.xml
  5. +13
    -0
      app/src/main/res/drawable/spinner_drop_down_item_1.xml
  6. +1
    -3
      app/src/main/res/layout/from/layout/activity_dzcjy.xml
  7. +7
    -8
      app/src/main/res/layout/spinner_dropdown_item.xml
  8. +2
    -1
      app/src/main/res/layout/spinner_text_item.xml
  9. +10
    -0
      app/src/main/res/values/styles.xml

+ 2
- 1
app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java View File

@@ -2,6 +2,7 @@ package com.example.bpa.view.from;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
@@ -162,9 +163,9 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
this,
R.layout.spinner_text_item,
new ArrayList<String>(datamaps.keySet()));

adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
values_spinner.setAdapter(adapter);

}

/**


+ 1
- 1
app/src/main/res/drawable/settingbutton.xml View File

@@ -11,7 +11,7 @@
android:angle="45" />
<padding
android:left="10dp"
android:top="10dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp" />
<stroke


+ 2
- 2
app/src/main/res/drawable/spinner_background.xml View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/light_blue_900" />
<corners android:radius="8dp" />
<solid android:color="#0077c2ff" />
<corners android:radius="25dp" />
<stroke
android:width="2dp"
android:color="@color/light_blue_600" />


+ 3
- 3
app/src/main/res/drawable/spinner_border.xml View File

@@ -4,15 +4,15 @@
<item>
<shape>
<stroke
android:width="2dp"
android:width="1dp"
android:color="@color/light_blue_900">
</stroke>
<corners android:radius="5dp" />
<!-- 设置背景颜色 -->
<solid android:color="#d1f2eb" />
<solid android:color="#2f77c2ff" />
<padding
android:bottom="3dp"
android:left="25dp"
android:left="30dp"
android:right="5dp"
android:top="3dp" >
</padding>


+ 13
- 0
app/src/main/res/drawable/spinner_drop_down_item_1.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/checkedTextViewCustom_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:textColor="@color/white"
android:background="#8f77c2ff"
android:textSize="16sp"
android:layout_gravity="center_vertical"
android:text="11111"/>

+ 1
- 3
app/src/main/res/layout/from/layout/activity_dzcjy.xml View File

@@ -137,9 +137,7 @@
android:layout_width="wrap_content"
android:layout_margin="5dp"
android:spinnerMode="dropdown"
style="@style/TechSpinnerStyle"
android:popupBackground="@drawable/btn_greenblue"
android:background="@drawable/spinner_border"
style="@style/commonSpinnerStyle"
/>
<Button
android:id="@+id/materilwrite_button"


+ 7
- 8
app/src/main/res/layout/spinner_dropdown_item.xml View File

@@ -1,14 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/checkedTextViewCustom"
android:id="@+id/checkedTextViewCustom_1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="#EF132D54"
android:ellipsize="marquee"
android:singleLine="true"
android:text="11111"
android:textAlignment="inherit"
android:textColor="@color/colorPrimaryDark"
android:background="#9CECFB"
android:textSize="16sp"
android:layout_gravity="center_vertical"
android:text="11111"/>
android:textColor="@color/white"
android:textSize="16sp" />

+ 2
- 1
app/src/main/res/layout/spinner_text_item.xml View File

@@ -7,8 +7,9 @@
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:textColor="@color/colorPrimary"
android:textColor="@color/white"
android:textSize="14dp"
android:gravity="center_vertical"
android:text="请选择">

</TextView>


+ 10
- 0
app/src/main/res/values/styles.xml View File

@@ -179,6 +179,16 @@
<item name="android:paddingBottom">4dp</item>
<item name="android:textColor">@color/white</item>
</style>
<style name="commonSpinnerStyle" parent="Widget.AppCompat.Spinner">
<item name="android:background">@drawable/spinner_border</item>
<item name="android:popupBackground">@color/borderBrush</item>
<item name="android:dropDownVerticalOffset">40dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:textColor">@color/white</item>
</style>
<style name="EnableEditTextStyle" parent="@android:style/Widget.EditText">
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textSize">16dp</item>


Loading…
Cancel
Save