I am creating phonebook like default android device .
I have already tired all possible solution available on this site but none of help me.
When user click on contact name , new layout should be open top to bottom.
But when I click on listItem animation not come bottom to top and layout does not display. However when I click again it show to effect of top to bottom sliding.
I found some problem here because when I put run without below animation its working fine.
bottom_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="75%p" android:toYDelta="0%p"
android:fillAfter="true"
android:duration="500"/>
</set>
Below is my code
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/myListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
<LinearLayout
android:id="@+id/hidden_panel"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="vertical"
android:background="#2196F3"
>
<ImageView
android:id="@+id/imgBack"
android:padding="5dp"
android:layout_gravity="left|top"
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
</LinearLayout>
</FrameLayout>
hiddenPanel = (ViewGroup)findViewById(R.id.hidden_panel);
hiddenPanel.setVisibility(View.INVISIBLE);
isPanelShown = false;
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
if(isPanelShown==false)
{
Animation bottomUp = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.bottom_up);
ViewGroup hiddenPanel = (ViewGroup)findViewById(R.id.hidden_panel);
hiddenPanel.startAnimation(bottomUp);
hiddenPanel.setVisibility(View.VISIBLE);
isPanelShown=true;
}
else
{
Animation bottomUp = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.bottom_down);
ViewGroup hiddenPanel = (ViewGroup)findViewById(R.id.hidden_panel);
hiddenPanel.startAnimation(bottomUp);
hiddenPanel.setVisibility(View.INVISIBLE);
isPanelShown=false;
}
}
});