Distorted toggle button image
up vote
1
down vote
favorite
I have found several duplicate questions. I'm having exactly the same problem:
Android Studio | How do I scale the image in ToggleButton?
Android Toggle Button distorted view
However, their problems haven't been solved yet so I just want to ask a new question again. So the third one on the left is what the second is supposed to be.
The second button is a custom toggle button, the idea of which comes from here: Android: Create a toggle button with image and no text
And I place these buttons in a horizontal LinearLayout
.
This is the xml of that part:
<LinearLayout
android:id="@+id/post_button_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/post_content"
app:layout_constraintHorizontal_bias="0.807"
app:layout_constraintStart_toStartOf="@+id/post_content"
app:layout_constraintTop_toBottomOf="@+id/post_divider2">
<ImageButton
android:id="@+id/post_comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_comment"
tools:layout_editor_absoluteX="37dp"
tools:layout_editor_absoluteY="500dp" />
<ToggleButton
android:id="@+id/toggleButton"
style="@style/CollectToggle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_collect_toggle_bg"/>
<ImageButton
android:id="@+id/post_collect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_collection"
tools:layout_editor_absoluteX="288dp"
tools:layout_editor_absoluteY="508dp" />
<ImageButton
android:id="@+id/post_share"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_share"
tools:layout_editor_absoluteX="104dp"
tools:layout_editor_absoluteY="508dp" />
</LinearLayout>
android android-togglebutton
add a comment |
up vote
1
down vote
favorite
I have found several duplicate questions. I'm having exactly the same problem:
Android Studio | How do I scale the image in ToggleButton?
Android Toggle Button distorted view
However, their problems haven't been solved yet so I just want to ask a new question again. So the third one on the left is what the second is supposed to be.
The second button is a custom toggle button, the idea of which comes from here: Android: Create a toggle button with image and no text
And I place these buttons in a horizontal LinearLayout
.
This is the xml of that part:
<LinearLayout
android:id="@+id/post_button_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/post_content"
app:layout_constraintHorizontal_bias="0.807"
app:layout_constraintStart_toStartOf="@+id/post_content"
app:layout_constraintTop_toBottomOf="@+id/post_divider2">
<ImageButton
android:id="@+id/post_comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_comment"
tools:layout_editor_absoluteX="37dp"
tools:layout_editor_absoluteY="500dp" />
<ToggleButton
android:id="@+id/toggleButton"
style="@style/CollectToggle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_collect_toggle_bg"/>
<ImageButton
android:id="@+id/post_collect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_collection"
tools:layout_editor_absoluteX="288dp"
tools:layout_editor_absoluteY="508dp" />
<ImageButton
android:id="@+id/post_share"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_share"
tools:layout_editor_absoluteX="104dp"
tools:layout_editor_absoluteY="508dp" />
</LinearLayout>
android android-togglebutton
and what's that@style/CollectToggle
??
– Martin Zeitler
Nov 10 at 21:45
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have found several duplicate questions. I'm having exactly the same problem:
Android Studio | How do I scale the image in ToggleButton?
Android Toggle Button distorted view
However, their problems haven't been solved yet so I just want to ask a new question again. So the third one on the left is what the second is supposed to be.
The second button is a custom toggle button, the idea of which comes from here: Android: Create a toggle button with image and no text
And I place these buttons in a horizontal LinearLayout
.
This is the xml of that part:
<LinearLayout
android:id="@+id/post_button_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/post_content"
app:layout_constraintHorizontal_bias="0.807"
app:layout_constraintStart_toStartOf="@+id/post_content"
app:layout_constraintTop_toBottomOf="@+id/post_divider2">
<ImageButton
android:id="@+id/post_comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_comment"
tools:layout_editor_absoluteX="37dp"
tools:layout_editor_absoluteY="500dp" />
<ToggleButton
android:id="@+id/toggleButton"
style="@style/CollectToggle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_collect_toggle_bg"/>
<ImageButton
android:id="@+id/post_collect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_collection"
tools:layout_editor_absoluteX="288dp"
tools:layout_editor_absoluteY="508dp" />
<ImageButton
android:id="@+id/post_share"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_share"
tools:layout_editor_absoluteX="104dp"
tools:layout_editor_absoluteY="508dp" />
</LinearLayout>
android android-togglebutton
I have found several duplicate questions. I'm having exactly the same problem:
Android Studio | How do I scale the image in ToggleButton?
Android Toggle Button distorted view
However, their problems haven't been solved yet so I just want to ask a new question again. So the third one on the left is what the second is supposed to be.
The second button is a custom toggle button, the idea of which comes from here: Android: Create a toggle button with image and no text
And I place these buttons in a horizontal LinearLayout
.
This is the xml of that part:
<LinearLayout
android:id="@+id/post_button_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/post_content"
app:layout_constraintHorizontal_bias="0.807"
app:layout_constraintStart_toStartOf="@+id/post_content"
app:layout_constraintTop_toBottomOf="@+id/post_divider2">
<ImageButton
android:id="@+id/post_comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_comment"
tools:layout_editor_absoluteX="37dp"
tools:layout_editor_absoluteY="500dp" />
<ToggleButton
android:id="@+id/toggleButton"
style="@style/CollectToggle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/ic_collect_toggle_bg"/>
<ImageButton
android:id="@+id/post_collect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_collection"
tools:layout_editor_absoluteX="288dp"
tools:layout_editor_absoluteY="508dp" />
<ImageButton
android:id="@+id/post_share"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/screen_background_light_transparent"
app:srcCompat="@drawable/ic_share"
tools:layout_editor_absoluteX="104dp"
tools:layout_editor_absoluteY="508dp" />
</LinearLayout>
android android-togglebutton
android android-togglebutton
edited Nov 10 at 21:16
0X0nosugar
6,71631742
6,71631742
asked Nov 10 at 20:53
Seaky Luo
62
62
and what's that@style/CollectToggle
??
– Martin Zeitler
Nov 10 at 21:45
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04
add a comment |
and what's that@style/CollectToggle
??
– Martin Zeitler
Nov 10 at 21:45
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04
and what's that
@style/CollectToggle
??– Martin Zeitler
Nov 10 at 21:45
and what's that
@style/CollectToggle
??– Martin Zeitler
Nov 10 at 21:45
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2fstackoverflow.com%2fquestions%2f53243305%2fdistorted-toggle-button-image%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
and what's that
@style/CollectToggle
??– Martin Zeitler
Nov 10 at 21:45
@MartinZeitler Actually I just change the name of the style in the 3rd link from toggleButton to CollectToggle
– Seaky Luo
Nov 10 at 22:04