团队开发冲刺日(八)

  今日打卡:记录界面敲定,设计瑕疵排查中

  代码:

主界面

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:app="http://schemas.android.com/apk/res-auto"
 4     xmlns:tools="http://schemas.android.com/tools"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     android:orientation="vertical"
 8     tools:context=".MainActivity">
 9 
10     <LinearLayout
11         android:layout_width="wrap_content"
12         android:layout_height="wrap_content"
13         android:orientation="horizontal">
14 
15         <EditText
16             android:id="@+id/title"
17             android:layout_width="300dp"
18             android:layout_height="wrap_content"
19             android:hint="请输入标题"></EditText>
20 
21         <Switch
22             android:id="@+id/see"
23             android:layout_marginLeft="50dp"
24             android:layout_width="wrap_content"
25             android:layout_height="wrap_content"
26             android:textOn="公开"
27             android:textOff="不公开"
28             ></Switch>
29 
30     </LinearLayout>
31 
32     <EditText
33         android:id="@+id/note"
34         android:layout_width="match_parent"
35         android:layout_height="500dp"
36         android:gravity="top"
37         android:singleLine="false"
38         android:inputType="textMultiLine"
39         android:scrollbars="vertical"
40         android:maxLines="20"
41         android:hint="请输入正文"
42         ></EditText>
43 
44     <com.example.toa.MyGridView
45         android:id="@+id/gridView"
46         android:layout_width="match_parent"
47         android:layout_height="wrap_content"
48         android:columnWidth="90dp"
49         android:layout_margin="5dp"
50         android:layout_weight="111"
51         android:gravity="center"
52         android:horizontalSpacing="5dp"
53         android:numColumns="4"
54         android:scrollbars="none"
55         android:stretchMode="columnWidth">
56     </com.example.toa.MyGridView>
57 
58     <Button
59         android:id="@+id/handin"
60         android:layout_width="match_parent"
61         android:layout_height="50dp"
62         android:text="上传"
63         >
64     </Button>
65 </LinearLayout>

gridview界面和dialog界面未改动。

java方面添加:

1 note = (EditText)findViewById(R.id.note);
2 note.setHorizontallyScrolling(true);

实现输入框滚动。

改动了最大图片设置,设置为三张:

 1 public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
 2         // TODO Auto-generated method stub
 3         if (imageItem.size() == 4) { // 第一张为默认图片
 4             Toast.makeText(MainActivity.this, "图片数3张已满",
 5                     Toast.LENGTH_SHORT).show();
 6         } else if (position == 0) { // 点击图片位置为+ 0对应0张图片
 7             // 选择图片
 8             dialog.show();
 9 
10             // 通过onResume()刷新数据
11         } else {
12             dialog(position);
13         }
14 
15     }

效果如下:

 右上按钮设置为该笔记是否公开。

瑕疵:图片显示不全,GridView板块存在垂直滚动条。

明后两天任务(周二满课,未必能写完):记录功能结束。

原文地址:https://www.cnblogs.com/20183711PYD/p/12740584.html