Comments (7)
Another way to check it is to use a scrollView as the custom view of the dialog.
This one can even occur on normal screens.
example:
final AlertDialogPro.Builder builder=new AlertDialogPro.Builder(activity,...);
builder.setTitle(...);
final TextView textView=new TextView(activity);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,18);
final ScrollView sv=new ScrollView(activity);
sv.addView(textView);
final int padding=(int)ViewUtil.convertDpToPixels(4);
sv.setPadding(padding,padding,padding,padding);
sv.setFillViewport(true);
builder.setView(sv);
textView.setTextColor(...);
textView.setText(...); // <=really long text with lots of lines
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setClickable(true);
builder.setPositiveButton(android.R.string.ok,null);
builder.show();
from alertdialogpro.
I think adding a weight to "customPanel" would fix this:
<FrameLayout
android:id="@+id/customPanel"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
Also, here's a layout I've used in the past, with ActionBarSherlock. It might be of help.
Speaking of this layout, why did you make a new LinearLayout? the support library already has this. Is it so that it would support more Android versions?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/alertDialog__parentPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/alertDialog__topPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/alertDialog__titleTemplate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center_vertical|start"
android:minHeight="@dimen/abs__alert_dialog_title_height"
android:orientation="horizontal" >
<ImageView
android:id="@+id/alertDialog__icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:src="@android:drawable/sym_def_app_icon" />
<com.lb.app_manager.utils.alert_dialog.DialogTitle
android:id="@+id/alertDialog__alertTitle"
style="@style/DialogWindowTitle.Sherlock.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="title"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:id="@+id/alertDialog__titleDivider"
android:layout_width="match_parent"
android:layout_height="2dip"
android:background="@color/abs__holo_blue_light"
android:visibility="visible" />
<!-- If the client uses a customTitle, it will be added here. -->
</LinearLayout>
<ScrollView
android:id="@+id/alertDialog__contentPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:minHeight="64dp" >
<TextView
android:id="@+id/alertDialog__message"
style="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:paddingBottom="8dip"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dip"
android:text="message"
tools:ignore="HardcodedText" />
</ScrollView>
<FrameLayout
android:id="@+id/alertDialog__customPanel"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1" />
<ImageView
android:id="@+id/alertDialog__dividerAboveButtonsView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="false"
android:scaleType="fitXY"
android:src="?attr/alert_dialog_divider" />
<com.actionbarsherlock.internal.widget.IcsLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="?attr/alert_dialog_divider"
android:gravity="center_horizontal"
android:measureWithLargestChild="true"
android:orientation="horizontal"
android:showDividers="middle|beginning|end"
tools:ignore="UnusedAttribute,MissingRegistered" >
<Button
android:id="@+id/alertDialog__negativeButton"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:maxLines="2"
android:minHeight="@dimen/alert_dialog_button_bar_height"
android:textColor="?android:textColorPrimary"
android:textSize="14sp" />
<Button
android:id="@+id/alertDialog__neutralButton"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:maxLines="2"
android:minHeight="@dimen/alert_dialog_button_bar_height"
android:textColor="?android:textColorPrimary"
android:textSize="14sp" />
<Button
android:id="@+id/alertDialog__positiveButton"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:maxLines="2"
android:minHeight="@dimen/alert_dialog_button_bar_height"
android:textColor="?android:textColorPrimary"
android:textSize="14sp" />
</com.actionbarsherlock.internal.widget.IcsLinearLayout>
from alertdialogpro.
Yes, that can be fixed by adding a weight to "customPanel". You can also do this in the code by replacing builder.show()
with below code:
AlertDialogPro alertDialogPro = builder.create();
alertDialogPro.show();
((LinearLayout.LayoutParams)
alertDialogPro.getWindow().findViewById(R.id.customPanel).getLayoutParams()).weight = 1;
BTW:
If you just want a multi choice ListView, I suggest you to use the setMultiChoiceItems
API instead of setting a custom ListView. It works fine.
from alertdialogpro.
why did you make a new LinearLayout?
Firstly, the alertdialogpro module doesn't depend on the appcompat-v7. It's not necessary to do this. So I just ported the LinearLayoutICS.java from appcompat-v7.
Secondly, Sometime ago, when I tried to make this project, the LinearLayoutICS.java of appcompat-v7 was not visible at that time. It was hided by@hide
tag. Recently Google makes it visible in version 21.
from alertdialogpro.
About the weight,please put it in your code too. It's a bug since the dialog should show its buttons if I choose to show them...
About the listView, I've made more than just multi-choice. You can check out my app to see the various dialogs there:
https://play.google.com/store/apps/details?id=com.lb.app_manager
About the LinearLayout, I see. Makes sense.
from alertdialogpro.
Done: 60d38d2
from alertdialogpro.
Cool. I made a difference :)
from alertdialogpro.
Related Issues (20)
- Compatibility with support v20 HOT 3
- Suggestion: publish on those websites HOT 3
- Possible to use AlertDialogPro with ListPreference widget?
- White buttons in Activity when using dark theme with AppCompat 22 HOT 2
- ProgressDialogPro exception HOT 12
- adpButtonBarPositiveButtonStyle with Holo theme HOT 5
- Add support for the new Support library 22.1 HOT 6
- Resource not found Exception for Api > 21 HOT 4
- Checkbox Buttons Offset on Xperia T HOT 1
- Error when tryin do compile 23 SDK version HOT 3
- Do it support accent color of edittext in the alert dialog pro? HOT 1
- NoClassDefFoundError AllCapsTransformationMethod HOT 2
- Caused by: java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintTypedArray HOT 1
- hope upgrade to compile 'com.android.support:appcompat-v7:23.1.1' HOT 2
- in support v7 23.1.1 android.support.v7.internal become private how to solve this problem? HOT 1
- Failed to resolve: com.github.fengdai:alertdialogpro-theme-material:0.2.6 HOT 2
- Changing texts' typeface HOT 3
- have error with compile 'com.android.support:appcompat-v7:23.2.1' HOT 2
- 示例代码报错? HOT 1
- Issue About Deprecated Then How Can Handle That Issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alertdialogpro.