Merge pull request #1097 from kekkyojin/remove_stages_scrollbar
Avoid showing vertical scroll bar on stage error listview
This commit is contained in:
commit
036b49a871
2 changed files with 19 additions and 1 deletions
|
@ -40,6 +40,7 @@ import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
@ -2745,6 +2746,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
||||||
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
|
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
|
|
||||||
|
// Add 1 pixel to listview height
|
||||||
|
int listHeight = Math.round(getResources().getDisplayMetrics().density);
|
||||||
|
|
||||||
|
for (int i = 0; i < startupStages.size(); i++) {
|
||||||
|
View item = adapter.getView(i, null, listView);
|
||||||
|
item.measure(0, 0);
|
||||||
|
listHeight += item.getMeasuredHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Properly set listview height by adding all seven items and the divider heights
|
||||||
|
// and the additional 1 pixel so no vertical scroll bar is shown
|
||||||
|
ViewGroup.LayoutParams params = listView.getLayoutParams();
|
||||||
|
params.height = listHeight + (listView.getCount() + 1) * listView.getDividerHeight();
|
||||||
|
listView.setLayoutParams(params);
|
||||||
|
listView.invalidate();
|
||||||
|
listView.requestLayout();
|
||||||
|
|
||||||
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
|
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
|
||||||
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
|
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/startup_stage_error_listview"
|
android:id="@+id/startup_stage_error_listview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:divider="@android:color/transparent"
|
android:divider="@android:color/transparent"
|
||||||
android:dividerHeight="8dp"
|
android:dividerHeight="8dp"
|
||||||
|
|
Loading…
Reference in a new issue