Skip to content

Commit

Permalink
Fix LoginView with lots of buttons
Browse files Browse the repository at this point in the history
It's vertical now and scrolls!

Fixes #1
  • Loading branch information
BtbN committed Jun 18, 2018
1 parent 47d95e1 commit a6d9970
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 40 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "de.oromit.flagcarrier"
minSdkVersion 19
targetSdkVersion 27
versionCode 10
versionName "1.9"
versionCode 11
versionName "1.10"
}
buildTypes {
release {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/de/oromit/flagcarrier/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ protected void onCreate(Bundle savedInstanceState) {
private void populateButtons() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
LinearLayout layout = findViewById(R.id.buttonLayout);

layout.removeAllViews();

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

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT,
1.0f
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);

for(String pos: pos_avail) {
Expand Down
69 changes: 34 additions & 35 deletions app/src/main/res/layout/activity_login.xml
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="@android:color/background_dark"
tools:context=".LoginActivity">

<TextView
android:id="@+id/loginTextView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text=""
android:textColor="@android:color/white"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="@+id/buttonLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:id="@+id/buttonLayout"
android:layout_width="0dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
<TextView
android:id="@+id/loginTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
android:text=""
android:textColor="@android:color/white"
android:textSize="18sp"
android:layout_weight="1"/>

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/buttonLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
android:orientation="vertical"
android:layout_weight="0">

</android.support.constraint.ConstraintLayout>
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />

<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>

</LinearLayout>
</ScrollView>

0 comments on commit a6d9970

Please sign in to comment.