codingdir logo sitemap sitemap |
Home
PHP
C#
C++
ANDROID
JAVA
JAVASCRIPT
PYTHON

Last tab in action bar is cropped, goes off screen


By : , Category : android

I have already answer a question like that one : Tab item width in Action Bar (Android)

ReLated :

Since you are making a 2D game, I presume you are using the orthogonal camera. Unlike perspective camera, the orthogonal camera shows more stuff on the screen the bigger resolution you have.

You need to normalize the orthogonal size to a wanted resolution:

 camera.orthographicSize = 640/screenwidth * screenheight/2

In the above code the orthogonal size is normalized to 640 pixel width. (Link)

This is the trick that I use

use framelayout

   <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
    >

       <ImageView
           android:id="@+id/wheel_image"
           android:layout_width="image width"
           android:layout_height="image height"
           android:src="@drawable/wheel_test"
           android:layout_gravity="center" />

works like a charm.

and that's my first contribution here. hope it works with you

The arguments that come after -i control the output, not the input.

To set the source resolution use -video_size with the xdpyinfo output before the -i. For the framerate use -framerate.

The format for the x11grab input is [hostname]:display_number.screen_number[+x_offset,y_offset].

ffmpeg -video_size `DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -framerate 30 -f x11grab -i :5.0+0,0 output.mpg

Check the docs and the guide: https://trac.ffmpeg.org/wiki/Capture/Desktop

Have you tried testing it on an emulator with soft menu buttons like the nexus series? These phones' aspect ratios are not really far from other phones like the galaxy s3, s4, etc. But to answer your question, if you really want your layout to be flexible for everything, there are 3 options I can think of:

[1] if you don't mind scrolling, you could wrap your parent RelativeLayout which is @+id/prime inside a ScrollView. Or take a look at your xml file that I modified. Just replace the drawables with the one you supplied:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/prime"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#8B008B"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="5dp"
        tools:context="com.example.testznanja.MainActivity" >

        <RelativeLayout
            android:id="@+id/rl"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:background="@drawable/question_layout" >

            <TextView
                android:id="@+id/questionText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center"
                android:text="Large Text"
                android:textAppearance="?android:attr/textAppearanceLarge" />
        </RelativeLayout>

        <Button
            android:id="@+id/beginTest"
            android:layout_width="match_parent"
            android:layout_height="52dp"
            android:layout_below="@+id/infoPanel"
            android:layout_marginTop="25dp"
            android:background="@drawable/button_normal"
            android:text="Button" />

        <Button
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/beginTest"
            android:layout_marginTop="18dp"
            android:background="@drawable/button_normal"
            android:text="Button" />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/button2"
            android:layout_marginTop="18dp"
            android:background="@drawable/button_normal"
            android:text="Button" />

        <Button
            android:id="@+id/button4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/button3"
            android:layout_marginTop="18dp"
            android:background="@drawable/button_normal"
            android:text="Button" />

        <RelativeLayout
            android:id="@+id/infoPanel"
            android:layout_width="match_parent"
            android:layout_height="35dp"
            android:layout_below="@+id/rl"
            android:layout_marginTop="25dp"
            android:background="@drawable/info_panel_layout"
            android:paddingLeft="5dp"
            android:paddingRight="5dp" >

            <TextView
                android:id="@+id/questionsAnswers"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:text="Skor: 0"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <TextView
                android:id="@+id/timer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:gravity="right"
                android:text="Vreme: 20"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <TextView
                android:id="@+id/help"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="50:50"
                android:textAppearance="?android:attr/textAppearanceLarge" />
        </RelativeLayout>

        <View
            android:id="@+id/dummy"
            android:layout_width="match_parent"
            android:layout_height="800dp"
            android:layout_below="@+id/button4"
            android:background="#ff4444" />
    </RelativeLayout>

</ScrollView>

Notice that I added a View with a red background and android:id="@+id/dummy" at the bottom. This is to let you see the scroll effect and simulate a scenario of cropping. Just remove it if you don't need it.

[2] If you want everything to fit inside the screen without having to scroll down, you should convert your parent RelativeLayout into a LinearLayout and use weights for every child. This approach is more complicated and entails much work since you have to calculate the weight for each child and you have to pretty much change every width and height of the children in the xml you already have.

[3] Redesign your layout so that it would always have extra space to accommodate different device aspect ratios, and redesign your images and backgrounds. I suggest you read on the Android Design Guidelines.

The first one is the easiest of the 3. If you want your layout to be as flexible as possible, I'm sorry my friend but I can't think of an easier way to do that.

Comments


Message :
Login to Add Your Comments .
How to disable registered OpenCL platforms on Windows?
Is Observable broken in Angular 2 Beta 3?
Cross-thread operation not valid when using Invoke
How to pass an IEnumerable or queryable list of properties from Controller to View
Finding numbers after a certain keyword using Python
Pocketsphinx recognizes random phrases in a silence
Passing non-thread-safe objects through thread-safe containers
React scroll nav
BizTalk WCF-BasicHttp Adapter does not allow Empty string for Service Certificate Props
Why property ''cause" of Exception is repeating forever?
Privacy Policy 2017 © codingdir.com All Rights Reserved .