Avoid showing vertical scroll bar on stage error listview
This commit is contained in:
parent
e6b83877f1
commit
c8c6305757
2 changed files with 19 additions and 1 deletions
|
@ -40,6 +40,7 @@ import android.view.KeyEvent;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
@ -2750,6 +2751,23 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
|
|||
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
|
||||
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_error_container).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<ListView
|
||||
android:id="@+id/startup_stage_error_listview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="8dp"
|
||||
|
|
Loading…
Reference in a new issue