android-framelayout

FrameLayout does not match the height of NestedScrollView

血红的双手。 提交于 2019-12-05 16:40:00
问题 I have a FrameLayout inside a NestedScrollView, as <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000"> But the FrameLayout is not filling the height of the NestedScrollView. How might I fix this? 回答1: Check This Solution Use fillViewport="true" this

Check fragment is presented in framelayout or not in android?

♀尐吖头ヾ 提交于 2019-12-05 08:02:04
Hi friends I have two framelayout in movies.xml namely container , detail_screen .In container will add movies.xml which contains listview ,and in detail_screen will have expandable listview called movie_details.xml .Now want to check programatically in detail_screen is already fragment presented or not.if presented just want remove that fragment.I did by follwing and its working fine. if (getSupportFragmentManager().findFragmentByTag("MyFragment") != null) { getSupportFragmentManager().beginTransaction().remove(getSupportFragmentManager().findFragmentByTag("MyFragment")).commit(); } but is

android - overlap images (playing cards)

喜欢而已 提交于 2019-12-05 07:49:55
I am trying to make the playing cards in my game overlap such that only the first half of a card is seen and the other half is covered by the next playing card. The only card that should be completely visible will be the last/rightmost card. I have used the following code with both framelayout and relativelayout to no avail. can anyone offer some suggestions? public int shouldShow(int numberOfCards, int card, int id) { if(card == -1) hide(id); else { findViewById(id).setBackgroundDrawable(deckimages[card]); //findViewById(id).offsetLeftAndRight(findViewById(id).getWidth()* numberOfCards / 2);

Programmatically adding fragment to framelayout in android

感情迁移 提交于 2019-12-04 22:29:59
I am trying to build a UI combining both static and dynamic elements. For this, I have divided my activity into fragments - all app navigation is then done by replacing fragments instead of navigating between activities. In my main activity layout, I am using a FrameLayout : <FrameLayout android:id="@+id/mainframe" android:layout_height="match_parent" android:layout_width="match_parent" android:layout_below="@id/topsection" android:layout_above="@id/lowersection" /> I have a fragment declared as such: public class MyFragment extends Fragment { @Override public View onCreateView(LayoutInflater

Take screenshot

为君一笑 提交于 2019-12-04 18:59:41
I am working on an app, which uses the frontcamera to simulate a mirror for the person using the app. I have implemented a "Head-up-Display" which is in front of the cameraview and displays some stuff. This works fine at the moment. Now I'd like to implement a method to take a screenshot every 5s. But how to take a screenshot? I tried one possible solution, but this just takes a screenshot of the HuD without the mirror, because I have to pass a view (v1) to this method: // create bitmap screen capture Bitmap b1; View v1 = (RelativeLayout) findViewById(R.id.RelLayout); v1.setDrawingCacheEnabled

What can be the difference of using a fragment and frameLayout in android? Can both be used interchangeably?

不羁岁月 提交于 2019-12-04 18:06:33
问题 I have seen an approach where frameLayout is used in case of fragments. The ultimate goal was to have multiple fragments. 回答1: For showing a single Fragment immediately on the screen, yes, you can use fragment or FrameLayout interchangeably. Single Fragment, Method 1 Showing the Fragment via the fragment tag would look like this in XML: <fragment class="com.example.ExampleFragment" android:id="@+id/details" android:layout_weight="1" android:layout_width="0px" android:layout_height="match

Rotate Frame layout which contains dynamic buttons

☆樱花仙子☆ 提交于 2019-12-04 02:32:39
I have a Framelayout which add four imageview at runtime as well in center it contains main image with which user can perform different action but i face the problem with rotate layout view currently on touch of rotate button i'm doing this public void setRotateListener() { mRotateImage.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { float x = event.getX(0); float y = event.getY(0); float theta = getTheta(x, y); switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_POINTER_DOWN: theta_old = theta; break; case

'Call requires API level 23' error, but getForeground() exists on FrameLayout from API 1

为君一笑 提交于 2019-12-03 19:50:07
问题 Summary Finally, I found the related issue, setForeground() incorrectly flagged as requiring API 23 on ViewGroups extending FrameLayout . Issue 189041: setForeground() incorrectly flagged as requiring API 23 (NewApi) for ViewGroups extending FrameLayout If you are not extending FrameLayout , the documentation is wrong and API 23 is required. Issue 186273: View.setForeground wrong API level Updated question Marked as duplicated of Can't use setForeground method on ImageView by Commonsware and

How to create an overlay that blocks touch events to UI below it?

喜你入骨 提交于 2019-12-03 13:29:27
问题 I used a layer of framelayout with a semi-translucent background to create an overlay. But this overlay doesn't block touch events to interact with the views below it. How should create an overlay that blocks all touch events? 回答1: Following code will add overlay on top of everything : View v1 = new View(this); WindowManager.LayoutParams params = new WindowManager.LayoutParams( 1000, 50, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |

What can be the difference of using a fragment and frameLayout in android? Can both be used interchangeably?

纵饮孤独 提交于 2019-12-03 12:18:15
I have seen an approach where frameLayout is used in case of fragments. The ultimate goal was to have multiple fragments. For showing a single Fragment immediately on the screen, yes, you can use fragment or FrameLayout interchangeably. Single Fragment, Method 1 Showing the Fragment via the fragment tag would look like this in XML: <fragment class="com.example.ExampleFragment" android:id="@+id/details" android:layout_weight="1" android:layout_width="0px" android:layout_height="match_parent" /> Single Fragment, Method 2 Showing the Fragment via FrameLayout would look like this in XML: