change some parameters of an <include layout












0















I have an existing <include layout and need to change two parameters of this layout programmatically to set it in a TableLayout
one time have to perform:



 android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"


and another time



 android:layout_height="wrap_content"


this is the layout



<include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"
android:layout_width="0dp"// or wrap
android:layout_margin="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
app:layout_constraintBottom_toBottomOf="parent"//one time want t call another time not
/>


I do not need a ViewStub as here, because do not need to change the layout indicated in include, but the parameters inside include!



EDIT:



and this is the new include layout:



    <include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
/>









share|improve this question

























  • I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

    – Drocchio
    Nov 20 '18 at 15:24













  • This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

    – Mike M.
    Nov 20 '18 at 16:08













  • please see my edit Mike, does not work for some reasons I cannot debug

    – Drocchio
    Nov 20 '18 at 16:18













  • Sorry, but I don't understand what you're saying.

    – Mike M.
    Nov 20 '18 at 16:21






  • 1





    worked perfect, thank you Mike

    – Drocchio
    Nov 21 '18 at 12:11
















0















I have an existing <include layout and need to change two parameters of this layout programmatically to set it in a TableLayout
one time have to perform:



 android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"


and another time



 android:layout_height="wrap_content"


this is the layout



<include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"
android:layout_width="0dp"// or wrap
android:layout_margin="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
app:layout_constraintBottom_toBottomOf="parent"//one time want t call another time not
/>


I do not need a ViewStub as here, because do not need to change the layout indicated in include, but the parameters inside include!



EDIT:



and this is the new include layout:



    <include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
/>









share|improve this question

























  • I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

    – Drocchio
    Nov 20 '18 at 15:24













  • This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

    – Mike M.
    Nov 20 '18 at 16:08













  • please see my edit Mike, does not work for some reasons I cannot debug

    – Drocchio
    Nov 20 '18 at 16:18













  • Sorry, but I don't understand what you're saying.

    – Mike M.
    Nov 20 '18 at 16:21






  • 1





    worked perfect, thank you Mike

    – Drocchio
    Nov 21 '18 at 12:11














0












0








0








I have an existing <include layout and need to change two parameters of this layout programmatically to set it in a TableLayout
one time have to perform:



 android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"


and another time



 android:layout_height="wrap_content"


this is the layout



<include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"
android:layout_width="0dp"// or wrap
android:layout_margin="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
app:layout_constraintBottom_toBottomOf="parent"//one time want t call another time not
/>


I do not need a ViewStub as here, because do not need to change the layout indicated in include, but the parameters inside include!



EDIT:



and this is the new include layout:



    <include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
/>









share|improve this question
















I have an existing <include layout and need to change two parameters of this layout programmatically to set it in a TableLayout
one time have to perform:



 android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"


and another time



 android:layout_height="wrap_content"


this is the layout



<include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"
android:layout_width="0dp"// or wrap
android:layout_margin="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
app:layout_constraintBottom_toBottomOf="parent"//one time want t call another time not
/>


I do not need a ViewStub as here, because do not need to change the layout indicated in include, but the parameters inside include!



EDIT:



and this is the new include layout:



    <include
android:id="@+id/search_results_cv"
layout="@layout/addresses_card_view"

app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/my_location_cv"
/>






android android-layout android-tablayout android-constraintlayout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 8:14







Drocchio

















asked Nov 20 '18 at 15:18









DrocchioDrocchio

93110




93110













  • I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

    – Drocchio
    Nov 20 '18 at 15:24













  • This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

    – Mike M.
    Nov 20 '18 at 16:08













  • please see my edit Mike, does not work for some reasons I cannot debug

    – Drocchio
    Nov 20 '18 at 16:18













  • Sorry, but I don't understand what you're saying.

    – Mike M.
    Nov 20 '18 at 16:21






  • 1





    worked perfect, thank you Mike

    – Drocchio
    Nov 21 '18 at 12:11



















  • I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

    – Drocchio
    Nov 20 '18 at 15:24













  • This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

    – Mike M.
    Nov 20 '18 at 16:08













  • please see my edit Mike, does not work for some reasons I cannot debug

    – Drocchio
    Nov 20 '18 at 16:18













  • Sorry, but I don't understand what you're saying.

    – Mike M.
    Nov 20 '18 at 16:21






  • 1





    worked perfect, thank you Mike

    – Drocchio
    Nov 21 '18 at 12:11

















I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

– Drocchio
Nov 20 '18 at 15:24







I do not need to change the dimensions, how can I change layout height to wrap_content in dimens?

– Drocchio
Nov 20 '18 at 15:24















This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

– Mike M.
Nov 20 '18 at 16:08







This answer should be of some help. In your case, after getting the ConstraintLayout.LayoutParams, you would set lp.bottomToBottom to the ID of whichever View is the new constraint. To wrap the height, you set lp.height to LayoutParams.WRAP_CONTENT. After you set your values, set the LayoutParams back on the View with setLayoutParams(lp).

– Mike M.
Nov 20 '18 at 16:08















please see my edit Mike, does not work for some reasons I cannot debug

– Drocchio
Nov 20 '18 at 16:18







please see my edit Mike, does not work for some reasons I cannot debug

– Drocchio
Nov 20 '18 at 16:18















Sorry, but I don't understand what you're saying.

– Mike M.
Nov 20 '18 at 16:21





Sorry, but I don't understand what you're saying.

– Mike M.
Nov 20 '18 at 16:21




1




1





worked perfect, thank you Mike

– Drocchio
Nov 21 '18 at 12:11





worked perfect, thank you Mike

– Drocchio
Nov 21 '18 at 12:11












0






active

oldest

votes











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396141%2fchange-some-parameters-of-an-include-layout%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396141%2fchange-some-parameters-of-an-include-layout%23new-answer', 'question_page');
}
);

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







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()