Skip to content

Commit a6d9970

Browse files
committed
Fix LoginView with lots of buttons
It's vertical now and scrolls! Fixes #1
1 parent 47d95e1 commit a6d9970

3 files changed

Lines changed: 39 additions & 40 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "de.oromit.flagcarrier"
77
minSdkVersion 19
88
targetSdkVersion 27
9-
versionCode 10
10-
versionName "1.9"
9+
versionCode 11
10+
versionName "1.10"
1111
}
1212
buildTypes {
1313
release {

app/src/main/java/de/oromit/flagcarrier/LoginActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ protected void onCreate(Bundle savedInstanceState) {
4343
private void populateButtons() {
4444
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
4545
LinearLayout layout = findViewById(R.id.buttonLayout);
46+
4647
layout.removeAllViews();
4748

4849
String[] pos_avail = prefs.getString("pos_avail", "left,mid,right").split(",");
4950

5051
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
51-
LinearLayout.LayoutParams.WRAP_CONTENT,
52-
LinearLayout.LayoutParams.WRAP_CONTENT,
53-
1.0f
52+
LinearLayout.LayoutParams.MATCH_PARENT,
53+
LinearLayout.LayoutParams.WRAP_CONTENT
5454
);
5555

5656
for(String pos: pos_avail) {
Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
2+
<ScrollView
3+
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7+
android:fillViewport="true"
78
android:background="@android:color/background_dark"
89
tools:context=".LoginActivity">
910

10-
<TextView
11-
android:id="@+id/loginTextView"
12-
android:layout_width="0dp"
13-
android:layout_height="0dp"
14-
android:layout_marginBottom="8dp"
15-
android:layout_marginTop="8dp"
16-
android:text=""
17-
android:textColor="@android:color/white"
18-
android:textSize="18sp"
19-
app:layout_constraintBottom_toTopOf="@+id/buttonLayout"
20-
app:layout_constraintEnd_toEndOf="parent"
21-
app:layout_constraintStart_toStartOf="parent"
22-
app:layout_constraintTop_toTopOf="parent" />
23-
2411
<LinearLayout
25-
android:id="@+id/buttonLayout"
26-
android:layout_width="0dp"
12+
android:orientation="vertical"
13+
android:layout_width="match_parent"
2714
android:layout_height="wrap_content"
28-
android:layout_marginBottom="16dp"
29-
android:orientation="horizontal"
30-
app:layout_constraintBottom_toBottomOf="parent"
31-
app:layout_constraintEnd_toEndOf="parent"
32-
app:layout_constraintStart_toStartOf="parent">
15+
android:layout_marginTop="8dp"
16+
android:layout_marginBottom="8dp">
3317

34-
<Button
35-
android:id="@+id/button"
36-
android:layout_width="wrap_content"
18+
<TextView
19+
android:id="@+id/loginTextView"
20+
android:layout_width="match_parent"
3721
android:layout_height="wrap_content"
38-
android:layout_weight="1"
39-
android:text="Button" />
22+
android:text=""
23+
android:textColor="@android:color/white"
24+
android:textSize="18sp"
25+
android:layout_weight="1"/>
4026

41-
<Button
42-
android:id="@+id/button2"
43-
android:layout_width="wrap_content"
27+
<LinearLayout
28+
android:id="@+id/buttonLayout"
29+
android:layout_width="match_parent"
4430
android:layout_height="wrap_content"
45-
android:layout_weight="1"
46-
android:text="Button" />
47-
</LinearLayout>
31+
android:orientation="vertical"
32+
android:layout_weight="0">
4833

49-
</android.support.constraint.ConstraintLayout>
34+
<Button
35+
android:id="@+id/button"
36+
android:layout_width="match_parent"
37+
android:layout_height="wrap_content"
38+
android:text="" />
39+
40+
<Button
41+
android:id="@+id/button2"
42+
android:layout_width="match_parent"
43+
android:layout_height="wrap_content"
44+
android:text="" />
45+
</LinearLayout>
46+
47+
</LinearLayout>
48+
</ScrollView>

0 commit comments

Comments
 (0)