this is my xml code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/tt">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trashParent"
android:visibility="visible"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<LinearLayout
android:background="@drawable/bgtrash"
android:layout_width="match_parent"
android:layout_height="140dp"
android:baselineAligned="false"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/parentTrash"
android:layout_marginBottom="30dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
<
</LinearLayout>
as we can see the parent View with id android:id="@+id/tt"
its height and width its wrap_content i know if some child have android:layout_alignParentBottom="true"
so the wrap_conent not work its will be like match_parent
but now i do this in java i have to method will hide and show the child
private void hide(){
trashParent.setVisibility(View.GONE);
parentTrash.setVisibility(View.GONE);
}
private void show(){
trashParent.setVisibility(View.VISIBLE);
parentTrash.setVisibility(View.VISIBLE);
}
now when i hide the child and make it wrap_content its still match parent this the run code
hide();
RelativeLayout.LayoutParams chatHeadParentParamst = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
tt.setLayoutParams(chatHeadParentParamst);
tt.setBackgroundColor(Color.YELLOW);
change tt height to wrap_content because its be match parent some time
but after change to wrap_conent is still like match_parent
i think the child still not Gone
and i set it to wrap_conent
because when i use delay its work this the delay
hide();
Handler handler = new Handler(Looper.getMainLooper());
Runnable runnable = new Runnable() {
@Override
public void run() {
hide(); // i dont no must i call it again to work
RelativeLayout.LayoutParams chatHeadParentParamst = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
tt.setLayoutParams(chatHeadParentParamst);
tt.setBackgroundColor(Color.YELLOW);
Log.d("called now delay","wwwwwwwww");
}
};
handler.postDelayed(runnable, 1100);
with delay now its size chnage to wrap_conent without delay it be same like match_parent but all child visibility was gone
any solotio without delay i cant use LinerLayout i must use RaltiveLayout becuase i need child one over one