TextView vs Button for Android AlertDialog
up vote
3
down vote
favorite
I want to open an AlertDialog
on the click of either a Button
or TextView
but I am not sure what would work best. When a selection is made in the AlertDialog
, I want the bottom text to be updated with the selection. Here are the two options I have:
TextView
s only. Here, the LinearLayout
will have listener and will open AlertDialog
.
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Label" />
<TextView
android:id="@+id/selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textSize="18sp"
android:text="Select..." />
</LinearLayout>
TextView
and Button
. Here, the Button
will open the AlertDialog
and the text inside the Button
will be replaced with the selection.
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:text="Label"
android:textSize="16sp"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_marginTop="-20dp"
android:text="Select..."
android:textAllCaps="false"
android:textColor="@android:color/white"
android:gravity="start|center_vertical"
android:paddingLeft="15dp"
android:paddingStart="15dp"
android:paddingRight="15dp"
android:paddingEnd="15dp"
android:paddingTop="15dp"
android:textSize="18sp"
android:background="@android:color/transparent" />
android xml
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
3
down vote
favorite
I want to open an AlertDialog
on the click of either a Button
or TextView
but I am not sure what would work best. When a selection is made in the AlertDialog
, I want the bottom text to be updated with the selection. Here are the two options I have:
TextView
s only. Here, the LinearLayout
will have listener and will open AlertDialog
.
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Label" />
<TextView
android:id="@+id/selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textSize="18sp"
android:text="Select..." />
</LinearLayout>
TextView
and Button
. Here, the Button
will open the AlertDialog
and the text inside the Button
will be replaced with the selection.
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:text="Label"
android:textSize="16sp"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_marginTop="-20dp"
android:text="Select..."
android:textAllCaps="false"
android:textColor="@android:color/white"
android:gravity="start|center_vertical"
android:paddingLeft="15dp"
android:paddingStart="15dp"
android:paddingRight="15dp"
android:paddingEnd="15dp"
android:paddingTop="15dp"
android:textSize="18sp"
android:background="@android:color/transparent" />
android xml
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I want to open an AlertDialog
on the click of either a Button
or TextView
but I am not sure what would work best. When a selection is made in the AlertDialog
, I want the bottom text to be updated with the selection. Here are the two options I have:
TextView
s only. Here, the LinearLayout
will have listener and will open AlertDialog
.
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Label" />
<TextView
android:id="@+id/selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textSize="18sp"
android:text="Select..." />
</LinearLayout>
TextView
and Button
. Here, the Button
will open the AlertDialog
and the text inside the Button
will be replaced with the selection.
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:text="Label"
android:textSize="16sp"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_marginTop="-20dp"
android:text="Select..."
android:textAllCaps="false"
android:textColor="@android:color/white"
android:gravity="start|center_vertical"
android:paddingLeft="15dp"
android:paddingStart="15dp"
android:paddingRight="15dp"
android:paddingEnd="15dp"
android:paddingTop="15dp"
android:textSize="18sp"
android:background="@android:color/transparent" />
android xml
I want to open an AlertDialog
on the click of either a Button
or TextView
but I am not sure what would work best. When a selection is made in the AlertDialog
, I want the bottom text to be updated with the selection. Here are the two options I have:
TextView
s only. Here, the LinearLayout
will have listener and will open AlertDialog
.
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical">
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Label" />
<TextView
android:id="@+id/selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textSize="18sp"
android:text="Select..." />
</LinearLayout>
TextView
and Button
. Here, the Button
will open the AlertDialog
and the text inside the Button
will be replaced with the selection.
<TextView
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:text="Label"
android:textSize="16sp"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/label"
android:layout_marginTop="-20dp"
android:text="Select..."
android:textAllCaps="false"
android:textColor="@android:color/white"
android:gravity="start|center_vertical"
android:paddingLeft="15dp"
android:paddingStart="15dp"
android:paddingRight="15dp"
android:paddingEnd="15dp"
android:paddingTop="15dp"
android:textSize="18sp"
android:background="@android:color/transparent" />
android xml
android xml
asked Nov 11 '16 at 17:44
Alexiz Hernandez
88119
88119
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Answer is Button.
Button is a subclass of TextView. So it has all the features of TextView and additional features of Button class. Button adds a few stylistic changes (e.g., default background image, additional padding, ripple effect) to allow quicker adaptation to your designs.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Answer is Button.
Button is a subclass of TextView. So it has all the features of TextView and additional features of Button class. Button adds a few stylistic changes (e.g., default background image, additional padding, ripple effect) to allow quicker adaptation to your designs.
add a comment |
up vote
0
down vote
Answer is Button.
Button is a subclass of TextView. So it has all the features of TextView and additional features of Button class. Button adds a few stylistic changes (e.g., default background image, additional padding, ripple effect) to allow quicker adaptation to your designs.
add a comment |
up vote
0
down vote
up vote
0
down vote
Answer is Button.
Button is a subclass of TextView. So it has all the features of TextView and additional features of Button class. Button adds a few stylistic changes (e.g., default background image, additional padding, ripple effect) to allow quicker adaptation to your designs.
Answer is Button.
Button is a subclass of TextView. So it has all the features of TextView and additional features of Button class. Button adds a few stylistic changes (e.g., default background image, additional padding, ripple effect) to allow quicker adaptation to your designs.
answered Nov 14 '16 at 16:54
Harish Gyanani
25111
25111
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f146777%2ftextview-vs-button-for-android-alertdialog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown