Android - Create Scrolling buttons on top of Imageview
I have an activity with an ImageView that is bigger then the screen so it's inside a ScrollLayout.
I want to create buttons on top this imageView but:
- How can I place the buttons on the image if I don't see the whole image?
for example, I'm attaching an image that the green color represents the imageView and the red boxes represents the buttons. how can I put all the buttons on the image if it's scrollable?
android
add a comment |
I have an activity with an ImageView that is bigger then the screen so it's inside a ScrollLayout.
I want to create buttons on top this imageView but:
- How can I place the buttons on the image if I don't see the whole image?
for example, I'm attaching an image that the green color represents the imageView and the red boxes represents the buttons. how can I put all the buttons on the image if it's scrollable?
android
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32
add a comment |
I have an activity with an ImageView that is bigger then the screen so it's inside a ScrollLayout.
I want to create buttons on top this imageView but:
- How can I place the buttons on the image if I don't see the whole image?
for example, I'm attaching an image that the green color represents the imageView and the red boxes represents the buttons. how can I put all the buttons on the image if it's scrollable?
android
I have an activity with an ImageView that is bigger then the screen so it's inside a ScrollLayout.
I want to create buttons on top this imageView but:
- How can I place the buttons on the image if I don't see the whole image?
for example, I'm attaching an image that the green color represents the imageView and the red boxes represents the buttons. how can I put all the buttons on the image if it's scrollable?
android
android
asked Dec 28 '18 at 18:13
TheDragonerTheDragoner
58210
58210
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32
add a comment |
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32
add a comment |
1 Answer
1
active
oldest
votes
You can make both the image and the buttons scrollable by using e.g. a FrameLayout
as the direct child of the ScrollView
. So your xml would look like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53962655%2fandroid-create-scrolling-buttons-on-top-of-imageview%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can make both the image and the buttons scrollable by using e.g. a FrameLayout
as the direct child of the ScrollView
. So your xml would look like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
add a comment |
You can make both the image and the buttons scrollable by using e.g. a FrameLayout
as the direct child of the ScrollView
. So your xml would look like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
add a comment |
You can make both the image and the buttons scrollable by using e.g. a FrameLayout
as the direct child of the ScrollView
. So your xml would look like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
You can make both the image and the buttons scrollable by using e.g. a FrameLayout
as the direct child of the ScrollView
. So your xml would look like this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
answered Dec 28 '18 at 18:36
Ben P.Ben P.
23.3k31948
23.3k31948
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
add a comment |
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
but how can I put the buttons in custom places? I have an image that has red squares on it, on different places, so I want to create the buttons on top of those red squares.
– TheDragoner
Dec 28 '18 at 18:55
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
Do you know the pixel coordinates of the red squares? Or are you trying to compute them at runtime?
– Ben P.
Dec 28 '18 at 21:59
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
I can get the coordinates , but it would be different on different screen resolutions no?
– TheDragoner
Dec 30 '18 at 8:58
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53962655%2fandroid-create-scrolling-buttons-on-top-of-imageview%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
Maybe try one of these links: stackoverflow.com/questions/14211484/… stackoverflow.com/questions/7306453/…
– MrFisherman
Dec 28 '18 at 18:32